﻿(self.webpackChunkvk=self.webpackChunkvk||[]).push([[43639],{686478:(e,t,i)=>{"use strict";i.d(t,{default:()=>m});var r=i(667294),n=i(887854),s=i.n(n),o=i(408091),a=i(634777),c=i(379333),l="0 0 24 24",d="gift_24",u=!1;function _(){u||((0,a.addSpriteSymbol)(new(s())({id:d,viewBox:l,content:'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="gift_24"><g fill="none" fill-rule="evenodd"><path d="M0 0h24v24H0z" /><path d="M21 10v2a1 1 0 01-1 1h-1v6.5a2.5 2.5 0 01-2.5 2.5h-9A2.5 2.5 0 015 19.5V13h1-2a1 1 0 01-1-1v-2a2 2 0 012-2h14a2 2 0 012 2zm-8 3h6v2h-6v7h-2v-7H5v-2h6V8h2v5zm-1-5C9 8 5.5 7 5.5 5.5s2-3 3.5-2.5c1 .333 2 2 3 5 1-3 2-4.667 3-5 1.5-.5 3.5 1 3.5 2.5S15 8 12 8z" fill="currentColor" /></g></symbol>'})),u=!0)}var f=function(e){return(0,a.useIsomorphicLayoutEffect)((function(){_()}),[]),r.createElement(c.SvgIcon,(0,o.assign)({},e,{viewBox:l,id:d,width:isNaN(e.width)?24:+e.width,height:isNaN(e.height)?24:+e.height}))};f.mountIcon=_;const m=f},890803:(e,t,i)=>{"use strict";function r(){return{icon:'<svg fill="none" height="12" viewBox="0 0 12 12" width="12" xmlns="http://www.w3.org/2000/svg"><path d="M6 12A6 6 0 106 0a6 6 0 000 12z" fill="#99a2ad"/><path clip-rule="evenodd" d="M8.78 3.97c.3.3.3.77 0 1.06L5.53 8.28c-.3.3-.77.3-1.06 0L3.22 7.03a.75.75 0 011.06-1.06l.72.72 2.72-2.72c.3-.3.77-.3 1.06 0z" fill="#fff" fill-rule="evenodd"/></svg>',name:"check_circle_fill_12"}}i.d(t,{getIcon12CheckCircleFill:()=>r})},728638:(e,t,i)=>{"use strict";function r(){return{icon:'<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M10.6 2c.98.03 1.63.58 1.96 1.6l.06.18.04.15.06.2.04.13.03.01.06-.02.1-.04.13-.06c1.16-.53 2.05-.43 2.78.36l.1.12.67.83c.6.8.58 1.63 0 2.54l-.1.15-.1.14-.12.16-.05.1-.03.04v.02l.08.05.1.06.13.07c1.13.58 1.6 1.35 1.42 2.4l-.03.16-.2.87c-.13.56-.23.82-.63 1.19-.39.35-.83.5-1.42.55h-.18l-.16.01-.2.01-.15.02.01.12.01.08.03.14c.26 1.25-.03 2.1-.97 2.62l-.14.08-.96.47c-.9.4-1.72.2-2.48-.58l-.12-.13-.11-.13-.14-.15-.08-.08-.04-.04-.07.08-.09.08-.1.11c-.78.93-1.6 1.27-2.6.88L7 17.49l-.86-.42-.26-.13c-.39-.22-.6-.42-.82-.87a2.38 2.38 0 01-.13-1.54l.03-.19.04-.2L5 14 4.93 14l-.12-.01h-.15c-1.27-.03-2.03-.51-2.33-1.55l-.04-.15-.24-1.04c-.2-.97.2-1.72 1.11-2.28l.16-.1.15-.07.17-.1.13-.08v-.02l-.05-.08-.06-.1-.09-.12c-.76-1.02-.85-1.92-.22-2.8l.1-.12.67-.83c.64-.75 1.47-.9 2.48-.52l.17.07.15.06.18.08.11.04.03-.01.03-.08.04-.11.03-.14c.3-1.17.9-1.83 1.96-1.92L9.46 2zm-.05 1.47h-1.1l-.1.01c-.24.03-.4.16-.54.68l-.04.13-.04.17c-.09.29-.22.61-.39.93a4.8 4.8 0 00-.94.46 5.28 5.28 0 01-.95-.29l-.28-.13c-.2-.08-.36-.13-.48-.14h-.07a.45.45 0 00-.33.16l-.06.06-.64.8-.08.1c-.15.21-.17.4.16.88l.18.25c.18.26.35.57.5.9-.11.32-.19.65-.23.99a5.3 5.3 0 01-.83.6l-.28.14c-.5.28-.57.46-.53.72l.01.06.23 1 .04.13c.07.25.21.39.79.41l.32.02c.3.01.65.07 1 .16.18.29.4.55.63.8.02.43-.02.85-.1 1.18-.16.78 0 .9.32 1.06l.92.45c.1.05.19.07.28.07h.05c.15-.02.32-.13.55-.4l.21-.24c.21-.23.48-.47.78-.68l.24.01h.5l.24-.02c.3.22.57.46.78.69l.21.24c.27.3.44.4.6.4h.06c.05 0 .1-.02.14-.04l.08-.03.92-.45.12-.06c.24-.14.34-.32.2-1a5.07 5.07 0 01-.1-1.18c.24-.25.45-.51.64-.8.34-.1.7-.15 1-.16l.31-.02c.67-.03.75-.2.83-.54l.22-.93c.07-.33.07-.53-.5-.85l-.29-.15a5.26 5.26 0 01-.83-.59 4.87 4.87 0 00-.22-.98c.14-.34.32-.65.49-.9l.19-.26c.33-.48.3-.67.16-.88l-.04-.06-.65-.8c-.11-.13-.2-.23-.37-.26h-.06c-.13 0-.3.04-.54.14l-.3.13c-.27.11-.6.22-.94.28-.3-.18-.61-.33-.94-.45-.16-.3-.29-.62-.37-.9l-.1-.33c-.15-.56-.32-.66-.58-.68zM10 6.9a3.11 3.11 0 110 6.23 3.11 3.11 0 010-6.23zm0 1.48a1.64 1.64 0 100 3.27 1.64 1.64 0 000-3.27z" fill="currentColor"/></svg>',name:"gear_outline_20"}}i.d(t,{getIcon20GearOutline:()=>r})},290686:(e,t,i)=>{"use strict";function r(){return{icon:'<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g id="gift_outline_20__Icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="gift_outline_20__Icons-20/gift_outline_20"><g id="gift_outline_20__gift_outline_20"><path d="M0 0h20v20H0z"/><path d="M14.85 2.31c1.02 1.03 1.23 2.88-.26 4.19h.91a3 3 0 013 3v.5c0 .82-.1 1.15-.27 1.48a1.88 1.88 0 01-1.23.94v1.61c0 1.56-.16 2.13-.47 2.7-.3.57-.75 1.02-1.32 1.32l-.2.1c-.48.23-1.04.35-2.23.37h-5.3c-1.55 0-2.12-.16-2.69-.47a3.18 3.18 0 01-1.32-1.32l-.1-.2A5.12 5.12 0 013 14.3V12.4a1.88 1.88 0 01-1.23-.93c-.16-.3-.25-.6-.27-1.3V9.5a3 3 0 013-3h.91c-1.49-1.31-1.28-3.16-.26-4.19C6.37 1.1 8.74 1.04 10 3.57c1.26-2.53 3.63-2.47 4.85-1.26zM9.25 12.5H4.5v1.76l.01.4c.02.6.08.92.2 1.2l.08.16c.17.31.4.54.7.71l.17.08c.33.14.72.2 1.6.2h1.99V12.5zm6.25 0h-4.75v4.52h2l.4-.01c.6-.02.91-.08 1.19-.2l.16-.08c.31-.17.54-.4.71-.7.19-.36.27-.7.29-1.56V12.5zM9.16 8H4.5C3.67 8 3 8.67 3 9.5v.87c.02.23.04.31.09.4.03.06.08.1.14.14.11.06.22.08.63.09h5.39V8h-.09zm6.34 0h-4.76v3h5.4c.4 0 .52-.03.63-.09.06-.03.1-.08.14-.14.06-.12.09-.25.09-.78V9.5c0-.83-.67-1.5-1.5-1.5zM9.22 6.16c-.43-3.1-1.96-3.83-3-2.79C5.16 4.42 5.9 5.95 9 6.38l.26.04zm1.56 0l-.03.19.01.06.24-.03c3.1-.43 3.83-1.96 2.79-3-1.05-1.05-2.58-.32-3.01 2.78z" id="gift_outline_20__Icon-Color" fill="currentColor" fill-rule="nonzero"/></g></g></g></svg>',name:"gift_outline_20"}}i.d(t,{getIcon20GiftOutline:()=>r})},187567:(e,t,i)=>{"use strict";function r(){return{icon:'<svg fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.88 18.12a1.25 1.25 0 01-1.76 1.76l-7-7a1.25 1.25 0 010-1.76l7-7a1.25 1.25 0 011.76 1.76L9.77 12z" fill="currentColor"/></svg>',name:"chevron_left_24"}}i.d(t,{getIcon24ChevronLeft:()=>r})},276299:(e,t,i)=>{"use strict";function r(){return{icon:'<svg fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M14.23 12L8.12 5.88a1.25 1.25 0 111.76-1.76l7 7c.5.48.5 1.28 0 1.76l-7 7a1.25 1.25 0 01-1.76-1.76z" fill="currentColor"/></svg>',name:"chevron_right_24"}}i.d(t,{getIcon24ChevronRight:()=>r})},970929:(e,t,i)=>{"use strict";i.d(t,{default:()=>g});i(530522),i(66108),i(579665),i(95767),i(175115),i(59357),i(283946),i(991181),i(296253),i(83276);var r=i(19331),n=i(754259),s=i(324816),o=i(40906);function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!t||i.length!==t);r=!0);}catch(e){n=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw s}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return c(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}var l=Object.entries(s.EMOJI_HINTS).map((e=>{var t=a(e,2),i=t[0],r=a(t[1],2),n=(r[0],r[1]);return[new RegExp(`(\\s|^)(${(0,o.escapeRE)(n)}${n.endsWith(")")||n.endsWith("(")?"+":""})([\\s\\.,]|$)`,"gi"),i]})),d={q:"й",w:"ц",e:"у",r:"к",t:"е",y:"н",u:"г",i:"ш",o:"щ",p:"з","[":"х","]":"ъ",a:"ф",s:"ы",d:"в",f:"а",g:"п",h:"р",j:"о",k:"л",l:"д",";":"ж","'":"э",z:"я",x:"ч",c:"с",v:"м",b:"и",n:"т",m:"ь",",":"б",".":"ю","/":"."};browser.mac?d["\\"]="ё":d["`"]="ё";var u=new RegExp(`[${(0,o.escapeRE)(Object.keys(d).join(""))}]`,"gi"),_=e=>e.replace(u,(e=>d[e])),f=Object.entries(d).reduce(((e,t)=>{var i=a(t,2),r=i[0];return e[i[1]]=r,e})),m=new RegExp(`[${(0,o.escapeRE)(Object.keys(f).join(""))}]`,"gi"),h=e=>e.replace(m,(e=>f[e])),p=-184940019;const g=class{constructor(e){this.config={mvk:!1,peerId:null,maxInputLength:256},this.setConfig(e)}setConfig(e){Object.assign(this.config,e)}getQueries(e){if(!e||e.length>this.config.maxInputLength)return[""];var t=window.Wall&&window.Wall.replyNamesRE||window.post&&window.post.replyNamesRE;if(t){var i=t();i&&(e=e.replace(i,""))}e=e.toLowerCase(),e=(e=l.reduce(((e,t)=>{var i=a(t,2),r=i[0],s=i[1];return e.replace(r,((e,t,i,r)=>(t||"")+(0,n.emojiByteHexToSymbol)(s)+(r||"")))}),e)).replace(/^[\s\uFEFF\xA0]+|\n+$/g,"");for(var r=[e=(0,n.emojiRemoveSkinToneModifiers)(e)],s=0,o=[...r];s<o.length;s++){var c=o[s];r.push(_(c)),r.push(h(c))}for(var d=0,u=[...r];d<u.length;d++){var f=u[d];r.push(f.replace(/ё/g,"е")),r.push(f.replace(/е/g,"ё"))}for(var m=0,p=[...r];m<p.length;m++){var g=p[m];r.push(g.replace(/[.!?]+$/,""))}return Object.keys(r.reduce(((e,t)=>(e[t]=1,e)),{}))}isBotLinkEnabled(){return(0,r.partConfigEnabled)("stickers_bot_link")&&this.config.peerId!==p}getBotLinkUrl(){return this.config.mvk?`/mail?act=show&peer=${p}`:`/im?sel=${p}`}getBotLinkImageUrl(e){return`/images/stickers_suggestions_bot_${arguments.length>1&&void 0!==arguments[1]?arguments[1]:"light"}_${e}.png`}getBotLinkClickStatName(){return"stickers_suggestions_bot_link"}getBotLinkClickStatKeys(){return[]}isMoneyTransferEnabled(){return(0,r.partConfigEnabled)("stickers_money_transfer_suggestions")&&(this.isMoneySendEnabled()||this.isMoneyRequestEnabled())}isMoneySendEnabled(){return Boolean(this.config.moneyTransfer&&this.config.moneyTransfer.send)}isMoneyRequestEnabled(){return Boolean(this.config.moneyTransfer&&this.config.moneyTransfer.request)}}},104958:(e,t,i)=>{"use strict";i.d(t,{Emoji:()=>G});i(66108),i(579665),i(95767),i(820075),i(209865),i(175115),i(940851),i(751876),i(991181),i(296253),i(530522),i(283946),i(21466),i(59357);var r=i(324816),n=i(754259),s=i(898884),o=i(408270),a=i(857748),c=i(19331),l=i(695724),d=i(315544),u=i(11122),_=i(970929),f=i(494422),m=i(376270),h=i(386409),p=i(654612),g=i(376852),v=i(786067),k=i(40906),S=i(483295),w=i(826338),y=i(124041),E=i(749091),C=i(922377),T=i(310835),b=i(751595),j=i(870264),I=i(399321),P=i(665820),R=i(348230),N=i(290686),x=i(728638),L=i(890803),O=i(276299),B=i(187567);function A(){return A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},A.apply(this,arguments)}function H(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=D(e))){var t=0,i=function(){};return{s:i,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,n,s=!0,o=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,n=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw n}}}}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!t||i.length!==t);r=!0);}catch(e){n=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw s}}return i}(e,t)||D(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,t){if(e){if("string"==typeof e)return F(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?F(e,t):void 0}}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function K(){return(0,c.partConfigEnabled)("stickers_web_new_ui")}var G={opts:{},raw:{},last:0,shownId:!1,hasNewStickers:!1,preventMouseOver:!1,stickerPacksToLoad:[],ttShift:45,favoriteAvailable:!1,favoriteRemindOn:!1,favoriteRemindOff:!1,favoriteLimit:20,favoriteLimitNoticed:!1,isStickersPreloading:!1,stickerSizes:{},stickers:{},TAB_EMOJI:0,TAB_RECENT_STICKERS:-1,TAB_FAVORITE_STICKERS:-2,TAB_NEW_CONVO_STICKERS:-3,CLICK_DELAY:500,SORTED_EMOJI_SECTIONS_CODES:[-1,1,3,8,2,4,5,6,7,9],CACHED_HEIGHT_PROP:"_emojiHeight",CACHED_WIDTH_PROP:"_emojiWidth",BOTTOM_REST_FOR_ADD_EMOJI_CATEGORY:150,SHOW_TT_TIMEOUT:100,HIDE_TT_TIMEOUT:300,SHOWN_TT_CLS:"emoji_tt_shown",STICKER_REFERRERS:{RECENT:"recent",FAVORITE:"favourite",NEW_CONVO:"new_convo",KEYBOARD:"keyboard",STORY_KEYBOARD:"story_keyboard"},DELETE_FAV_STICKER_ELEMENTS_DELAY:500,FAV_ICON_TT_MIN_HEIGHT:35,SUGGESTION_WORD_MAX_LENGTH:256,logHintsDelay:0,tabDefaultId:0,stickersKeywordsExpire:36e5*(6+2*Math.random()),init:function(e,t){var i=G.last;G.tabDefaultId=G.TAB_RECENT_STICKERS,t.txt=e,t.id=i,t.fieldWrap=gpeByClass("_emoji_field_wrap",e),t.emojiWrap=domByClass(t.fieldWrap,"_emoji_wrap"),t.emojiBtn=domByClass(t.emojiWrap,"_emoji_btn"),t.emojiWrap&&(0,d.data)(t.emojiWrap,"optId",i),e.emojiId=i,t.lastLoadedEmojiCategoriesIdxes={},t.preventDoubleClick=vkNow(),t.deletedFavoriteStickers=[],t.deleteFavoriteStickersTimeout=null,t.suggestions=new _.default(t.suggestionsConfig);var r=(0,l.isRetina)()?128:64;if(G.stickerSizes[r]=!0,t.forceTxt)t.editable=0,placeholderInit(e);else{if(t.editable=1,setTimeout((function(){placeholderInit(e,{editable:1,editableFocus:G.editableFocus,global:t.global}),t.shouldFocus&&G.editableFocus(e,!1,!0)}),0),browser.mozilla)try{document.execCommand("enableObjectResizing",!1,!1),cur.destroy.push((function(){document.execCommand("enableObjectResizing",!1,!0)}))}catch(e){}addEvent(window,"mousemove",G.preventMouseOverHandle),addEvent(e,browser.opera&&!browser.chrome?"click":"mousedown",(function(r){if(r.target&&"IMG"==r.target.tagName&&G.getCode(r.target))return G.editableFocus(e,r.target,r.offsetX>8),cancelEvent(r);G.shown&&G.ttClick(i,geByClass1("emoji_smile",t.controlsCont),!0)})),t.noLineBreaks&&addEvent(e,"blur",(function(t){e.textContent||e.innerText||each(geByTag("br",e),(function(e,t){re(t)}))})),addEvent(e,"keypress keydown keyup input paste",(function(r){if(r.canceled)return!1;if("keydown"===r.type){t.onChange&&(G.raw[i]=e.innerHTML);var n=t.ctrlSend?t.ctrlSend():t.noEnterSend;if(r.keyCode==KEY.RETURN||10==r.keyCode){if(t.forceEnterSend&&t.onSend)return t.onSend(),cancelEvent(r);var s=cur.ctrl_submit&&!t.noCtrlSend;if((s||n)&&(r.ctrlKey||browser.mac&&r.metaKey)||!s&&!r.shiftKey&&!(r.ctrlKey||browser.mac&&r.metaKey)){var o=(0,d.data)(e,"composer");if(!G.emojiEnter(i,r)||!G.stickerHintMove(r)||o&&o.wdd&&isVisible(o.wdd.listWrap))return!1;if(!n||r.ctrlKey||browser.mac&&r.metaKey)return G.ttClick(i,geByClass1("emoji_smile",t.controlsCont),!0),t.onSend&&t.onSend(),cancelEvent(r)}if(t.noLineBreaks)return cancelEvent(r)}if(r.ctrlKey&&r.keyCode==KEY.RETURN){var a=this.value;if(t.editable)G.insertHTML("<div><br/></div>");else{if("number"==typeof this.selectionStart&&"number"==typeof this.selectionEnd){var l=this.selectionStart;this.value=a.slice(0,l)+"\n"+a.slice(this.selectionEnd),this.selectionStart=this.selectionEnd=l+1}else if(document.selection&&document.selection.createRange){this.focus();var u=document.selection.createRange();u.text="\r\n",u.collapse(!1),browser.opera&&!browser.chrome&&(u.moveEnd("character",0),u.moveStart("character",0)),u.select()}e.autosize.update(),setTimeout((function(){e.autosize.update()}),0)}return!1}var _=(0,m.hasAccessibilityMode)()&&(0,c.partConfigEnabled)("emoji_tooltip_a11y_mode");if(r.keyCode===KEY.TAB&&!(r.ctrlKey||browser.mac&&r.metaKey)&&!_){var f=geByClass1("_sticker_hints",domPN(t.txt));if(f&&isVisible(f)){var h=geByClass1("over",f);if(h?G.stickerHintKeyOut(i,h):G.stickerHintKeyOver(i,geByClass1("emoji_sticker_item",f)),!G.shown)return cancelEvent(r)}return G.shown?(G.editableFocus(e,!1,!0,void 0,!0),G.ttClick(i,geByClass1("emoji_smile",t.controlsCont),!0)):G.ttClick(i,geByClass1("emoji_smile",t.controlsCont),!1,!0,void 0,!0),cancelEvent(r)}if(r.keyCode==KEY.ESC){var p=geByClass1("_sticker_hints",domPN(t.txt)),g=!1;if(p&&isVisible(p)&&(G.stickerHintKeyOut(i,geByClass1("emoji_sticker_item",p)),G.stickersHintsHide(p,t,100),g=!0),G.shown&&(G.editableFocus(e,!1,!0,void 0,!0),G.ttClick(i,geByClass1("emoji_smile",t.controlsCont),!0),g=!0),g)return cancelEvent(r);if(t.onEsc)return t.onEsc(r)}}return"paste"===r.type?(G.onEditablePaste(e,t,i,r),t.checkEditable&&setTimeout(t.checkEditable.pbind(i,e),0),G.checkStickersKeywords(i,t)):"keyup"===r.type?(!t.noLineBreaks||e.textContent||e.innerText||each(geByTag("br",e),(function(e,t){re(t)})),t.checkEditable&&t.checkEditable(i,e),G.checkStickersKeywords(i,t),t.onChange&&(G.raw[i]!=e.innerHTML&&G.onChange(t),delete G.raw[i])):"keydown"!==r.type&&"input"!==r.type||(t.checkEditable&&setTimeout(t.checkEditable.pbind(i,e),0),G.checkStickersKeywords(i,t)),t.onKeyAction&&t.onKeyAction(r),cur.onReplyFormSizeUpdate&&cur.onReplyFormSizeUpdate(r),!0}))}return window.Notifier&&Notifier.addRecvClbk("emoji",0,G.lcRecv,!0),G.initStickersKeywords(),G.initPromotedStickerUrls(),G.checkNewStickers(t),G.opts[G.last]=t,G.last++},setSuggestionsConfig:function(e,t){G.opts[e].suggestions.setConfig(t)},onChange:function(e){(0,k.isFunction)(e.onChange)&&setTimeout(e.onChange,0)},preventMouseOverHandle:function(){G.preventMouseOver=!1},lcRecv:function(e){if("updateTabs"===e.act)G.updateTabs(e.newStickers,e.keywords)},correctCaret:function(e){var t=e?(0,f.getCaretBoundingRect)(e).bottom:0;(t<0||t>e.offsetHeight)&&(e.scrollTop+=t-e.offsetHeight)},insertWithBr:function(e,t){if(t){var i=t.replace(/\n/g,"<br/>"),r=ce("div",{innerHTML:i});G.cleanCont(r),G.insertHTML(r.innerHTML)}},insertWithoutNL:function(e,t){if(t){var i=t.replace(/\n/g,""),r=ce("div",{innerHTML:i});G.cleanCont(r),G.insertHTML(r.innerHTML)}},focusTrick:function(e,t,i,r,n){n||(n=e);var s=ce("TEXTAREA",{className:"emoji_tmp_textarea"});e.parentNode.appendChild(s),s.focus(),setTimeout((function(){var o=n.scrollTop;re(s),e.focus(),n.scrollTop=o,G.setRange(r),t(clean(val(s))),i(e)}),0)},finalizeInsert:function(e){G.cleanCont(e),setTimeout(G.correctCaret.pbind(e),10)},getClipboard:function(e){return e.clipboardData?clean(e.clipboardData.getData("text")):!!window.clipboardData&&clean(window.clipboardData.getData("Text"))},processImagePaste:function(e,t,i,r){if(null!=e.clipboardData){var n=function(){var n=e.clipboardData;function s(e){if(!e.match(/^webkit\-fake\-url\:\/\//)){var n=new Image;return n.crossOrigin="anonymous",n.onload=function(){var e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0,e.width,e.height),e.toBlob((function(e){!function(e){var r,n;if(e.name=e.filename="upload_"+(new Date).toISOString()+"_"+irand(0,100)+".png",hasClass(t,"_im_text")){if(i.uploadActions)return void i.uploadActions.paste([e])}else r="post_field"==t.id?cur.wallAddMedia:(n=(0,d.data)(t,"composer"))&&n.addMedia;r&&(0,k.isFunction)(i.initUploadForImagePasteCallback)&&i.initUploadForImagePasteCallback(t,r,e)}(e)}),"image/png"),r(!0)},n.src=e}}if(n.items){var o=!1,a=n.types;if((0,c.partConfigEnabled)("emoji_disable_new_html_processing")||a.includes("Files")||a.includes("text/plain"))for(var l=0,u=n.items.length;l<u;l++){var _=n.items[l];if(_.type.match(/^image\//)&&"file"===_.kind){var f=new FileReader;f.onload=function(e){return s(e.target.result)},f.readAsDataURL(_.getAsFile()),o=!0}else if("text/plain"===_.type)return{v:r()}}else if(n.types.includes("text/html")){var m=se(`<div>${n.getData("text/html")}</div>`).querySelectorAll("img");o=m.length>0,m.forEach((e=>{s(e.src)}))}return{v:o}}if(-1!==Array.prototype.indexOf.call(n.types,"text/plain"))return{v:r()};!function(e){for(var i=Math.floor(1e3*Math.random()),n=geByTag("img",t),s=0,o=n.length;s<o;s++)n[s]["_before_paste_"+i]=!0;setTimeout((function(){for(var n=geByTag("img",t),s=!1,o=0,a=n.length;o<a;o++){var c=n[o];c["_before_paste_"+i]||(e(c.src),re(c),s=!0)}s||r()}),1)}((function(e){return s(e)}))}();if("object"==typeof n)return n.v}else r()},detectInvalidClipboardData(e){if(!e.clipboardData)return!1;var t=e.clipboardData.types;if(t.includes("text/html")){if(t.includes("Files"))return!0;var i=e.clipboardData.getData("text/html");return i&&i.match(/<iframe/i)}return!1},onEditablePaste:function(e,t,i,r,n){var s=!1;"true"===e.getAttribute("contenteditable")&&(s=G.getRange());var o=this.getClipboard(r),a=o&&s&&!n;this.detectInvalidClipboardData(r)&&cancelEvent(r),(this.processImagePaste(r,e,t,function(i){i||(a?(t.noLineBreaks?this.insertWithoutNL(s,o):this.insertWithBr(s,o),setTimeout(this.finalizeInsert.bind(this,e),0)):s&&this.focusTrick(e,t.noLineBreaks?this.insertWithoutNL.pbind(s):this.insertWithBr.pbind(s),this.finalizeInsert.bind(this,e),s))}.bind(this))||a)&&cancelEvent(r),G.onChange(t)},cleanCont:function(e){for(var t=e.firstChild;t;){var i=t.nextSibling;switch(t.nodeType){case 1:if("tmp_paste_cont"==t.id)break;if("DIV"==t.tagName||"P"==t.tagName||"SPAN"==t.tagName)t.setAttribute("style",""),t.className="",t.id="",G.cleanCont(t);else if("IMG"==t.tagName)G.getCode(t)||re(t);else if("BR"!=t.tagName){var n=G.editableVal(t,{saveEmoji:!0}),o=cf(clean(n).replace(/\n/g,"<br/>"));t.parentNode.replaceChild(o,t)}break;case 3:var a=clean(t.textContent||t.innerText),c=(0,r.emojiRegex)();a&&a.match(c)&&(a=a.replace(c,s.emojiReplace),t.parentNode.replaceChild(cf(a),t))}t=i}},focus:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];G.editableFocus(e,!1,!0);var r=i||e.parentNode;if(t){var n=getXY(r)[1],s=scrollGetY(),o=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:boxLayerBG.offsetHeight,a=getSize(r)[1];s+o<n+a?scrollToY(n-o+a+60,100):s>n&&scrollToY(n-60,100)}},destroy:function(e){if(G.opts.hasOwnProperty(e)){var t=G.opts[e];t.txt&&t.txt.blur(),t.imagesLoader&&t.imagesLoader.destroy(),e===G.shownId&&(G.shownId=!1,G.shown=!1),delete G.opts[e]}},editableFocus:function(e,t,i,r,n){if(!e||n&&document.activeElement===e)return!1;if((e=ge(e)).focus(),e.phonfocus&&e.phonfocus(),void 0!==window.getSelection&&void 0!==document.createRange){var s=window.getSelection();if(!browser.opera||browser.chrome||i){var o=document.createRange();t?o.selectNode(t):o.selectNodeContents(e),browser.mozilla&&e.innerHTML.endsWith("<br>")&&e.removeChild(e.lastChild),r||o.collapse(!i),(s=window.getSelection()).removeAllRanges(),s.addRange(o)}else s.collapse(t||e,0)}else if(void 0!==document.body.createTextRange){var a=document.body.createTextRange();a.moveToElementText(t||e),a.collapse(!i),a.select()}},getRange:function(){if(window.getSelection){var e=window.getSelection();if(e.getRangeAt&&e.rangeCount)return e.getRangeAt(0)}else if(document.selection&&document.selection.createRange)return document.selection.createRange();return null},setRange:function(e){if(window.getSelection){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)}else document.selection&&e.select&&e.select()},val:function(e,t){if(void 0===t)return G.editableVal(e);t=(t=(0,s.emojiToHTML)(t,!0)).replace(/ $/,"&nbsp;"),e.setValue?(e.setValue(t),e.phonblur&&e.phonblur()):e.innerHTML=t,G.updateStickersHints();var i=(0,d.data)(e,"composer");return i&&window.Composer&&setTimeout(Composer.updateAutoComplete.pbind(i)),!0},editableVal:function(e,t){if(!e)return"";if("TEXTAREA"==e.tagName)return val(e);for(var i,r=e.firstChild,n="",s=new RegExp("^(DIV|P|LI|OL|TR|TD|BLOCKQUOTE)$");r;){switch(r.nodeType){case 3:n+=i=r.data.replace(/^\n|\n$/g," ").replace(/[\n\xa0]/g," ").replace(/[ ]+/g," ");break;case 1:if(i=G.editableVal(r),r.tagName&&r.tagName.match(s)&&i){"\n"!=i.substr(-1)&&(i+="\n");for(var o=r.previousSibling;o&&3==o.nodeType&&""==trim(o.nodeValue);)o=o.previousSibling;!o||o.tagName&&(o.tagName.match(s)||"BR"==o.tagName)||(i="\n"+i)}else if("IMG"==r.tagName){var a=G.getCode(r);a&&(t&&t.saveEmoji?i+=G.getEmojiHTML(a):i+=G.codeToChr(a))}else"BR"==r.tagName&&(i+="\n");n+=i}r=r.nextSibling}return n},cssEmoji:r.EMOJI_HINTS,getEmojiHTML:s.getEmojiHTML,codeToChr:n.emojiByteHexToSymbol,checkEditable:function(e,t,i){var r=t.scrollHeight,n=G.opts[e];if(!n)return!1;n.scPaddings||(n.scPaddings=intval(getStyle(t,"paddingTop"))+intval(getStyle(t,"paddingBottom"))),r-=n.scPaddings;var s=n.tt;if(r>i.height+(browser.mozilla&&n.isChat?0:5)){if(!n.isSized){setStyle(t,{height:i.height+"px",overflowY:"auto"});var o=geByClass1("emoji_smile",n.controlsCont),a=geByClass1("emoji_smile_icon_promo",n.controlsCont),c=ge("im_upload"),l=(0,h.sbWidth)();n.ttWrap&&(l+=getSize(n.ttWrap)[0]-(getXY(n.emojiBtn)[0]-getXY(n.ttWrap)[0])),setStyle(o,vk.rtl?{left:1+l}:{right:1+l}),a&&setStyle(a,vk.rtl?{left:2+l}:{right:2+l}),c&&setStyle(c.parentNode,vk.rtl?{left:1+l}:{right:1+l}),s&&setStyle(s,vk.rtl?{left:(n.ttDiff||31)+l}:{right:(n.ttDiff||31)+l}),n.isSized=!0}}else if(n.isSized){setStyle(t,{height:"auto",overflowY:"hidden"});var d=geByClass1("emoji_smile",n.controlsCont),u=geByClass1("emoji_smile_icon_promo",n.controlsCont),_=ge("im_upload");setStyle(d,vk.rtl?{left:1}:{right:1}),u&&setStyle(u,vk.rtl?{left:2}:{right:2}),_&&setStyle(_.parentNode,vk.rtl?{left:1}:{right:1}),s&&setStyle(s,vk.rtl?{left:n.ttDiff||31}:{right:n.ttDiff||31}),n.isSized=!1}n.onResize&&n.onResize()},stickersHintsShow:function(e,t,i){(isVisible(e)||fadeIn(e,i),t.stickerEventsInited)||((e&&geByClass1("_sticker_hints_inner",e)).addEventListener("wheel",G.onWheelStickersHints),addEvent(document,"keydown",G.stickerHintMove),t.onHintsMouseDown=function(){t.hintsClicked=!0,setTimeout((function(){delete t.hintsClicked}),0)},addEvent(e,"mousedown",t.onHintsMouseDown),t.txt&&(t.onTxtFocus&&(removeEvent(t.txt,"focus",t.onTxtFocus),delete t.onTxtFocus),t.onTxtBlur=function(r){if(t.hintsClicked)return cancelEvent(r),!0;G.stickersHintsHide(e,t,i)},addEvent(t.txt,"blur",t.onTxtBlur)),t.stickerEventsInited=!0);G.checkStickersHintsSize(e,t)},stickersHintsHide:function(e,t,i){(fadeOut(e,i),removeEvent(document,"keydown",G.stickerHintMove),t.onHintsMouseDown&&removeEvent(e,"mousedown",G.onHintsMouseDown),t.onHintsWheel)&&(e&&geByClass1("_sticker_hints_inner",e)).removeEventListener("wheel",G.onWheelStickersHints);t.txt&&(t.onTxtBlur&&(removeEvent(t.txt,"blur",t.onTxtBlur),delete t.onTxtBlur),t.onTxtFocus&&removeEvent(t.txt,"focus",t.onTxtFocus),t.onTxtFocus=function(){var e=t.txt&&geByClass1("_sticker_hints",domPN(t.txt));e&&!isVisible(e)&&(delete t.stickerHintsString,G.checkStickersKeywords(t.id,t,!1))},addEvent(t.txt,"focus",t.onTxtFocus)),delete t.stickerEventsInited,delete G.shownHintId,G.sendHintsLog()},stickerHintOver:function(e){G.stickerHintOut(e),addClass(e,"over")},stickerHintOut:function(e){each(geByClass("over",domPN(e)),(function(){removeClass(this,"over")}))},stickerHintClick:function(e,t,i,r){var n=G.opts[e]||{},s=n.txt,o=s&&geByClass1("_sticker_hints",domPN(s)),a="suggestion_"+G.stickerSuggestionQuery;return"stories"===n.ref&&(a="story_suggestion_"+G.stickerSuggestionQuery),t<0?G.previewSticker(!1,r,{stickerId:-t,sticker_referrer:a}):(val(s,""),G.stickerClick(e,t,256,i,r,a),n.checkEditable&&n.checkEditable(e,s)),G.stickersHintsHide(o,n,0),!1},stickerHintKeyOver:function(e,t){G.stickerHintOver(t),G.shownHintId=e},stickerHintKeyOut:function(e,t){G.stickerHintOut(t),delete G.shownHintId},stickerHintMove:function(e){var t=G.shownHintId;if(void 0===t)return!0;var i=G.opts[t],r=i&&geByClass1("_sticker_hints",domPN(i.txt));if(r&&isVisible(r)){var n=geByClass1("over",r)||geByClass1("emoji_sticker_item",r);switch(e.keyCode){case KEY.LEFT:return(n=domPS(n))&&(G.stickerHintOver(n),G.checkStickersHintsScroll(n)),cancelEvent(e),!1;case KEY.RIGHT:return(n=domNS(n))&&(G.stickerHintOver(n),G.checkStickersHintsScroll(n)),cancelEvent(e),!1;case KEY.ENTER:return n.click(),cancelEvent(e),!1}}return!0},checkStickersHintsSize:function(e,t,i){i&&(addClass(e,"_margin_transition"),(0,d.removeClassDelayed)(e,"_margin_transition")),setStyle(e,{marginLeft:0});var r=getXY(e),n=getSize(e),s=G.getEmojiTtXY(t.tt);t.tt&&s&&s[0]&&r[0]+n[0]+10>s[0]&&r[1]+n[1]>s[1]&&setStyle(e,{marginLeft:s[0]-r[0]-n[0]-10}),domFC(e)||G.stickersHintsHide(e,t,0)},getEmojiTtXY:function(e){return e&&hasClass(e,G.SHOWN_TT_CLS)?getXY(e):[0,0]},hintachCache:{},hintachNotFoundStickers:{},checkHintach:function(e,t,i){if((0,c.partConfigEnabled)("hintach"))return G.hintachCache[e]?requestAnimationFrame((()=>G.renderHintach(e,t,i,G.hintachCache[e]))):void ajax.post("/hintach",{query:e},{onDone:r=>{G.hintachCache[e]=r,G.renderHintach(e,t,i,G.hintachCache[e])}})},onHintachItemClick:function(e){var t=e.currentTarget.dataset.hint,i=parseInt(e.currentTarget.parentNode.dataset.opt);if(t&&!isNaN(i)){var r=G.opts[i]||{},n=r.txt,s=n&&geByClass1("_sticker_hints",domPN(n)),o=(0,a.parseAttachmentId)(t);return o&&r.onHintachSend&&(val(n,""),r.onHintachSend(o.type,o.rawId),r.checkEditable&&r.checkEditable(i,n),G.stickersHintsHide(s,r,0)),!1}},renderHintach:function(e,t,i,r){var n=t.txt,s=geByClass1("_sticker_hints",domPN(n)),o=isArray(r.photos)&&r.photos.length||isArray(r.docs)&&r.docs.length;if(e&&t.stickerHintsString&&o){var c=s&&geByClass1("_sticker_hints_inner",s);if(!c||t.noStickers)return!1;G.clearHintsLog(),G.hintachNotFoundStickers[e]&&(c.innerHTML="");var l=c.querySelector(".Hintach");l||(l=c.appendChild(ce("div",{className:"Hintach"}))),l.setAttribute("data-opt",t.id),l.innerHTML="";var d=64*window.devicePixelRatio,u=64*window.devicePixelRatio;(r.photos||[]).forEach((e=>{var t=(0,a.getPhotoSize)(e.sizes,d,u);if(t){var i=M(t,3),r=i[0],n=i[1],s=i[2],o=M((0,a.prepareImageBounds)(n,s),2),c=o[0],_=o[1],f=ce("div",{className:"Hintach__item Hintach__item--photo"});f.setAttribute("data-hint","photo"+e.id),f.appendChild(ce("div",{className:"Hintach__itemThumb"},{width:c,height:_,backgroundImage:`url(${r})`})),f.onclick=G.onHintachItemClick,l.appendChild(f)}})),(r.docs||[]).forEach((e=>{if(e.preview&&(e.preview.video||e.preview.graffiti)){var t=M(e.preview.video||e.preview.graffiti,3),i=t[0],r=t[1],n=t[2],s=M((0,a.prepareImageBounds)(r,n),2),o=s[0],c=s[1],d=ce("div",{className:"Hintach__item Hintach__item--doc"});d.setAttribute("data-hint","doc"+e.id);var u=d.appendChild(ce(e.preview.video?"video":"img",{className:"Hintach__itemPreview",src:i},{width:o,height:c}));e.preview.video&&(d.appendChild(ce("div",{className:"Hintach__itemType",innerHTML:"GIF"})),u.autoplay=!0,u.loop=!0),d.onclick=G.onHintachItemClick,l.appendChild(d)}})),l.childElementCount>0&&(G.stickersHintsShow(s,t,100),c.scrollLeft=0,G.checkStickersHintsScroll(s,c.scrollLeft))}},onMoneyTransferSuggestionClick:function(e,t,i){var r=G.opts[e],n=r.txt.parentNode.querySelector("._sticker_hints");if(G.stickersHintsHide(n,r,0),"send"===t&&r.suggestions.isMoneySendEnabled()||"request"===t&&r.suggestions.isMoneyRequestEnabled()){var s=r.suggestions.config,o=s.fromId,a=s.peer;u.default.onClick(o,a,t,i,{onSendStart:()=>{r.clearText&&r.clearText()}});var c=G.moneyTransferTextMatch&&G.moneyTransferTextMatch.input||"";statlogsValueEvent("stickers_money_transfer_suggestions","select",[t],c)}},renderMoneyTransferSuggestions:function(e,t){var i=G.opts[e],r=(0,l.isRetina)()?128:64,n={};return i.suggestions.isMoneyRequestEnabled()?n.request=`<a\n        class="emoji_sticker_item"\n        data-money-transfer-type="request"\n        onclick="Emoji.onMoneyTransferSuggestionClick(${e}, 'request', ${t.amount||0});">\n        <img class="emoji_sticker_image" src="/images/money/request/${r}.png" />\n      </a>`:n.request="",i.suggestions.isMoneySendEnabled()?n.send=`<a\n        class="emoji_sticker_item"\n        data-money-transfer-type="send"\n        onclick="Emoji.onMoneyTransferSuggestionClick(${e}, 'send', ${t.amount||0});">\n        <img class="emoji_sticker_image" src="/images/money/send/${r}.png" />\n      </a>`:n.send="",t.request?n.request+n.send:n.send+n.request},checkStickersKeywords:function(e,t,i){if(t.noStickers||!window.stickersKeywords||!window.stickersKeywordsData||!window.stickersKeywordsData.length)return!1;var r=i?0:100,n=t.txt,s=geByClass1("_sticker_hints",domPN(n)),o=function(i,r){if(G.stickers[G.TAB_RECENT_STICKERS]){var n=G.sortStickersHints(window.stickersKeywords[i]),o=G.stickers[G.TAB_RECENT_STICKERS].promoted,a="";r&&(a+=G.renderMoneyTransferSuggestions(e,r)),each(n,(function(){a+=G.render.stickerHintRs(e,this,o[this])})),t.suggestions.isBotLinkEnabled()&&(a+=G.renderSuggestionsBotLink(e)),G.showStickersHints(s,t,a)}},a=function(){var a=t.suggestions.getQueries(G.val(n));if(a.length){var c=a[0],l=t.suggestions.isMoneyTransferEnabled()&&u.default.match(c,1);if(l&&(a=[u.default.DEFAULT_QUERY]),G.moneyTransferTextMatch=l,!s&&!(s=G.initStickersHints(n)))return!1;if(c!=t.stickerHintsString){var d=a.find((e=>e&&window.stickersKeywords[e]&&window.stickersKeywords[e].length||l));if(G.stickerSuggestionQuery=d,d)if(G.stickers[G.TAB_RECENT_STICKERS])o(d,l);else{var _=t.onRecentEmojiUpdate;t.onRecentEmojiUpdate=function(e){_&&_(),e&&(_?t.onRecentEmojiUpdate=_:delete t.onRecentEmojiUpdate,o(d,l))},G.emojiLoadMore(e)}else G.hintachNotFoundStickers[c]=!0,G.stickersHintsHide(s,t,r);!l&&c&&c.length<20&&t.onHintachSend&&(clearTimeout(t.hintachCheckTimeout),t.hintachCheckTimeout=setTimeout((()=>{G.checkHintach(c,t,i)}),160)),t.stickerHintsString=c}}};i?a():(clearTimeout(t.stickerHintTT),t.stickerHintTT=setTimeout(a,s&&isVisible(s)?0:200))},showStickersHints:function(e,t,i){var r=e&&geByClass1("_sticker_hints_inner",e);if(!r||t.noStickers)return!1;G.clearHintsLog(),val(r,i),G.stickersHintsShow(e,t,100),r.scrollLeft=0,G.checkStickersHintsScroll(e,r.scrollLeft)},checkStickersHintsScroll:function(e,t){var i=domClosest("_sticker_hints",e),r=i&&geByClass1("_sticker_hints_inner",i),n=i&&geByClass1("_sticker_left",i),s=i&&geByClass1("_sticker_right",i);if(!r)return!1;var o=getSize(n)[0],a=getSize(s)[0];if(hasClass(e,"emoji_sticker_item")){var c=e.offsetLeft-8-o,l=e.offsetLeft+getSize(e)[1]+2+a-r.clientWidth;r.scrollLeft>c&&(r.scrollLeft=c),r.scrollLeft<l&&(r.scrollLeft=l),t=r.scrollLeft}var d=t>0,u=t+r.clientWidth<r.scrollWidth;toggle(n,d),toggleClass(i,"sticker_hints_left_pad",d),toggle(s,u),toggleClass(i,"sticker_hints_right_pad",u),t=void 0===t?r.scrollLeft:t;var _=r.querySelectorAll(".emoji_sticker_item"),f=d?o+8:0,m=u?a+2:0,h=Array.from(_).filter((e=>e.offsetLeft-f>=t&&e.offsetLeft+e.offsetWidth+m-r.clientWidth<=t));G.logHints(h.map((e=>intval(e.getAttribute("data-sticker-id")))).filter((e=>e)));var p=h.map((e=>e.getAttribute("data-money-transfer-type"))).filter((e=>e));if(p.length){var g=G.moneyTransferTextMatch&&G.moneyTransferTextMatch.input||"";statlogsValueEvent("stickers_money_transfer_suggestions","show",p,g)}},logHints:function(e){G.logHintsTimeout&&clearTimeout(G.logHintsTimeout),G.logHintsTimeout=setTimeout((()=>{G.hintsLogBuffer=e.reduce(((e,t)=>(e[t]=1,e)),G.hintsLogBuffer||{})}),G.logHintsDelay)},clearHintsLog:function(){G.logHintsTimeout&&clearTimeout(G.logHintsTimeout),G.hintsLogBuffer={}},sendHintsLog:function(){var e=G.hintsLogBuffer&&Object.keys(G.hintsLogBuffer),t=window.cur&&window.cur.emojiHintsSendLogHash;e&&e.length&&t&&ajax.post("stickers.php",{act:"log_hints",sticker_ids:e,hash:t}),G.clearHintsLog()},scrollStickersHints:function(e,t,i){var r=domClosest("_sticker_hints",e),n=r&&geByClass1("_sticker_hints_inner",r),s=r&&geByClass1("_sticker_left",r),o=r&&geByClass1("_sticker_right",r);if(!n)return!1;var a=n.scrollLeft+t*(n.clientWidth-2*getSize(e)[0]),c=geByClass("emoji_sticker_item",n);each(c,(function(e,i){return t>0&&i.offsetLeft-8-getSize(s)[0]>a?(a=c[e-1]&&c[e-1].offsetLeft-8-getSize(s)[0]||a,!1):t<0&&i.offsetLeft+getSize(i)[1]+2+getSize(o)[0]-n.clientWidth>a?(a=i.offsetLeft+getSize(i)[1]+2+getSize(o)[0]-n.clientWidth||a,!1):void 0})),a=Math.max(0,Math.min(n.scrollWidth-n.clientWidth,a)),animate(n,{scrollLeft:a},{duration:Math.abs(n.scrollLeft-a)+50,transition:Fx.Transitions.easeOutCubic}),G.checkStickersHintsScroll(n,a)},onWheelStickersHints:function(e){e.preventDefault(),e.stopPropagation();var t=e.currentTarget;t.scrollLeft+=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX,G.checkStickersHintsScroll(t,t.scrollLeft)},sortStickersHints:function(e){var t=[];G.stickers[-1]&&(t=G.stickers[-1].stickers);var i={},r=[];return each(t,(function(){inArray(this[0],e)&&!i[this[0]]&&(r.push(this[0]),i[this[0]]=1)})),each(e,(function(){i[this]||r.push(this)})),r},initStickersHints:function(e){return!!e&&domPN(e).insertBefore(se(`<div class="_sticker_hints sticker_hints_tt">\n      <div class="sticker_hints_arrow sticker_left _sticker_left" onmousedown="Emoji.scrollStickersHints(this, -1, event);cancelEvent(event);" onclick="cancelEvent(event);">\n        ${(0,B.getIcon24ChevronLeft)().icon}\n      </div>\n      <div class="_sticker_hints_inner sticker_hints_inner"></div>\n      <div class="sticker_hints_arrow sticker_right _sticker_right" onmousedown="Emoji.scrollStickersHints(this, 1, event);cancelEvent(event);" onclick="cancelEvent(event);">\n        ${(0,O.getIcon24ChevronRight)().icon}\n      </div>\n    </div>`),e)},updateStickersHints:function(e){G.opts&&each(G.opts,(function(t,i){e&&delete i.stickerHintsString,G.checkStickersKeywords(t,i,!0)}))},renderSuggestionsBotLink(e){var t=G.opts[e].suggestions,i=(0,l.isRetina)()?128:64;return`<a\n    class="emoji_sticker_item"\n    href="${t.getBotLinkUrl()}"\n    onClick="Emoji.onSuggestionsBotLinkClick(event, ${e});"\n    target="_blank">\n    <img class="emoji_sticker_image" src="${t.getBotLinkImageUrl(i)}" />\n  </a>`},onSuggestionsBotLinkClick(e,t){e.stopPropagation();var i=G.opts[t].suggestions;statlogsValueEvent(i.getBotLinkClickStatName(),0,...i.getBotLinkClickStatKeys())},initStickersKeywords:function(){if(!window.stickersKeywordsData){var e=ls.get("stickers_keywords");e&&e.time&&e.time>vkNow()-G.stickersKeywordsExpire&&(window.stickersKeywordsData=e.keywords)}window.stickersKeywordsData&&G.setStickersKeywords(window.stickersKeywordsData)},initPromotedStickerUrls:function(){if(!window.promotedStickerUrls){var e=ls.get("promoted_stickers_urls");if(e&&e.time&&e.time>vkNow()-G.stickersKeywordsExpire)window.promotedStickerUrls=e.stickerUrls;else{ajax.post("al_im.php",{act:"get_promoted_stickers"},{onDone:function(e){ls.set("promoted_stickers_urls",{time:vkNow(),stickerUrls:e}),window.promotedStickerUrls=e}})}}},cachedStickersKeywordsTime:function(){var e=ls.get("stickers_keywords");return e&&e.time?Math.floor(e.time/1e3):0},setStickersKeywords:function(e,t){if(!e)return!1;window.stickersKeywords={};var i=ce("div"),r=[],n="";if(e.forEach((function(e){var t=e.words||[],i=e.user_stickers||[],s=e.promoted_stickers||[],o=i.concat(s.map((function(e){return-e})));t.forEach((function(e){n+="\n"+e,r.push(o)}))})),val(i,n),(n=i.textContent||i.innerText)&&n.slice("\n".length).split("\n").forEach((function(e,t){window.stickersKeywords[e]=r[t]})),!G.stickers[G.TAB_RECENT_STICKERS]){var s=ls.get("recent_stickers");s&&(G.stickers[G.TAB_RECENT_STICKERS]=s)}t&&(ls.set("stickers_keywords",{time:vkNow(),keywords:e}),G.updateStickersHints(!0))},emojiEnter:function(e,t){var i=G.opts[e],r=(i.ctrlSend?i.ctrlSend():i.noEnterSend)||cur.ctrl_submit&&!i.noCtrlSend;if(i.emojiFocused&&i.emojiOvered&&i.openedByTabKey&&(r?!(t.ctrlKey||browser.mac&&t.metaKey):!t.shiftKey)){if(0===i.curTab){var n=geByTag1("img",i.emojiOvered)||geByTag1("i",i.emojiOvered);G.addEmoji(e,G.getCode(n),i.emojiOvered)}return cancelEvent(t)}return!0},insertHTML:function(e){if(browser.msie&&parseInt(browser.version)<12)if(document.selection){var t=document.selection.createRange();t.pasteHTML&&t.pasteHTML(e)}else{var i=document.getSelection().getRangeAt(0),r=document.createElement("span");i.surroundContents(r),r.innerHTML=e,i.collapse(!1)}else e&&document.execCommand("insertHTML",!1,e)},addEmoji:function(e,t,i){if(!1===e||!1===t)return!1;var r=G.opts[e];if(!(vkNow()-r.ttShowT<G.CLICK_DELAY)){if(r.editable){var n=G.getEmojiHTML(t,G.codeToChr(t),!0),s=r.txt,o=!!window.getSelection&&window.getSelection(),a=!1;if(o&&o.rangeCount){var c=o.getRangeAt(0);a=c.commonAncestorContainer?c.commonAncestorContainer:c.parentElement?c.parentElement():c.item(0)}for(var l=a;l&&l!=s;)l=l.parentNode;var u=s.lastChild||{};browser.mozilla&&"BR"==u.tagName&&!u.previousSibling&&re(s.lastChild),l||G.editableFocus(s,!1,!0),G.insertHTML(n);var _=geByClass("emoji",s);for(var f in _.push.apply(_,geByClass("emoji_css",s)),_)if(_.hasOwnProperty(f)){var m=_[f].previousSibling;if(m&&3==m.nodeType&&m.textContent&&32==m.textContent.charCodeAt(0)){var h=m.previousSibling;h&&3==h.nodeType&&h.textContent&&160==h.textContent.charCodeAt(h.textContent.length-1)&&re(m)}}s.check&&s.check(),setTimeout(G.correctCaret.pbind(s),5),G.onChange(r);var p=(0,d.data)(s,"composer");p&&window.Composer&&Composer.updateAutoComplete(p)}else{var g,v,k,S=r.txt,w=S.value;g=browser.iphone||browser.ipad?G.codeToChr(t):G.cssEmoji[t][1]+" ",null!=S.selectionStart&&null!=S.selectionEnd?(v=S.selectionEnd,S.value=w.slice(0,S.selectionStart)+g+w.slice(v),S.selectionStart=S.selectionEnd=v+g.length):void 0!==document.selection&&void 0!==document.selection.createRange&&(S.focus(),(k=document.selection.createRange()).text=g,k.select())}r.checkEditable&&r.checkEditable(e,r.txt),G.checkStickersKeywords(e,r),r.saveDraft&&r.saveDraft(),r.onEmojiAdded&&r.onEmojiAdded(),G.incrRecentEmojiRate(e,t)}},showShadow:function(){return!(browser.msie&&browser.version<10)},scrollToggleArrow:function(e,t,i,r){var n=geByClass1("emoji_tabs_"+t+"_s",i.tt);r?(e?show:hide)(n):e?fadeIn(n,200):fadeOut(n,200),i[t+"Shown"]=e},scrollTabs:function(e,t){var i=G.opts[e];if(i){var r,n=geByClass1("emoji_tabs_wrap",i.tt),s=n.firstChild.clientWidth-n.clientWidth;if(t){if((r=2==t?n.scrollLeft:n.scrollLeft+170)>=s){r=s;var o=geByClass1("emoji_tabs_r_s",i.tt);fadeOut(o,200),i.rShown=!1,G.scrollToggleArrow(!1,"r",i)}r&&!i.lShown&&G.scrollToggleArrow(!0,"l",i)}t&&2!=t||((r=2==t?n.scrollLeft:Math.max(n.scrollLeft-170,0))<=0&&(r=0,G.scrollToggleArrow(!1,"l",i)),r<s&&!i.rShown&&G.scrollToggleArrow(!0,"r",i)),2!=t&&(i.scrollLeft=r,animate(n,{scrollLeft:r},300))}},scrollToTab:function(e,t){var i=G.opts[t],r=i.tt,n=geByClass1("emoji_tabs_wrap",r),s=geByClass1("emoji_tab_"+e,r);if(s){var o=(0,d.data)(n,"tween");if(!o||!o.isTweening||e!=i.curTab){var a=getSize(s)[0],c=s.offsetLeft,l=getSize(n)[0],u=c-l/2+10;c+a<n.scrollLeft?n.scrollLeft=Math.max(c,n.scrollLeft-l/2):c+a-n.scrollLeft>l&&(n.scrollLeft=Math.min(c+a-n.scrollLeft,n.scrollLeft+l/2)),animate(n,{scrollLeft:u},300,(function(){G.scrollTabs(t,2)})),G.selectTab(t,e,s)}}},selectTab:function(e,t,i){var r=G.opts[e],n=r.tt,s=geByClass1("emoji_tabs",n),o=geByClass1("emoji_tab_sel",s);removeClass(o,"emoji_tab_sel"),addClass(i,"emoji_tab_sel"),r.curTab=t,cur.stickersTab=t,ls.set("stickers_tab",t)},tabsWheel:function(e,t){cancelEvent(e);var i=G.opts[t],r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX,n=geByClass1("emoji_tabs_wrap",i.tt),s=n.scrollLeft;n.scrollLeft+=r,s!=n.scrollLeft&&G.scrollTabs(t,2)},show:function(e,t){var i=(0,d.data)(domPN(e),"optId");void 0!==i&&G.ttShow(i,e,t)},hide:function(e,t,i){var r=(0,d.data)(domPN(e),"optId");void 0!==r&&G.ttHide(r,e,t,i)},ttShow:function(e,t,i){var r=G.opts[e];clearTimeout(r.ctt),clearTimeout(r.stt),r.scrolling&&(r.afterScrollFn=!1),r.ttShown||(t?r.obj=t:t=r.obj,r.stt=setTimeout((function(){G.ttClick(e,t,!1,!0,i)}),G.SHOW_TT_TIMEOUT))},ttHide:function(e,t,i,r){var n=G.opts[e];if(clearTimeout(n.stt),n.ttShown)if(n.scrolling)n.afterScrollFn=G.ttHide.pbind(e,t,i,r);else{t=t||n.obj||geByClass1("emoji_smile",n.controlsCont);var s=function(){G.ttClick(e,t,!0,!1,i)};r?s():(clearTimeout(n.ctt),n.ctt=setTimeout(s,G.HIDE_TT_TIMEOUT))}},ttClick:function(e,t,i,r,n,s){var o=G.opts[e];if(o&&!(i&&!G.shown||r&&G.shown)&&(t||(t=G.shown||ge(-3==cur.peer?"imw_smile":"im_smile")))){t.tt&&t.tt.destroy&&t.tt.destroy(),!o.tt&&o.sharedTT&&o.sharedTT.emojiTT&&(o.tt=o.sharedTT.emojiTT,o.emojiScroll=o.sharedTT.emojiScroll,o.allEmojiId=o.sharedTT.emojiAllId);var a,c=o.tt;if(!c){var l=ls.get("stickers_tab");l||(l=G.TAB_EMOJI),o.curTab=cur.stickersTab=G.TAB_EMOJI,l==G.TAB_EMOJI||o.noStickers||(G.stickers[G.TAB_RECENT_STICKERS]=ls.get("recent_stickers"),o.curTab=cur.stickersTab=l);var d='<div class="emoji_tabs_l_s" onmousedown="Emoji.scrollTabs('+e+', 0); return cancelEvent(event);" onclick="return cancelEvent(event)"><div class="emoji_sprite emoji_tabs_l_sc"></div><div class="emoji_sprite emoji_tabs_l_si"></div></div><div class="emoji_tabs_r_s" onmousedown="Emoji.scrollTabs('+e+', 1); return cancelEvent(event);" onclick="return cancelEvent(event);"><div class="emoji_sprite emoji_tabs_r_sc"></div><div class="emoji_sprite emoji_tabs_r_si"></div></div>';d+=G.getTabsCode([[0,1]],e),d+='<span class="emoji_tabs_wrap"><span id="emoji_tabs_cont_'+e+'" class="emoji_tabs_cont">',o.noStickers||!1===window.emojiStickers||void 0===window.emojiStickers||(d+=G.getTabsCode(window.emojiStickers,e));var u="",_='onmousedown="Emoji.showStickersStore('+e+'); return cancelEvent(event);" onclick="return cancelEvent(event);"',f="showTooltip(this, {text: '"+(0,v.getLang)("global_store_stickers")+"', shift: [4,6,6], showdt: 0, black: 1});";o.rPointer?_+=" onmouseover=\"addClass(this.parentNode.parentNode.parentNode, 'emoji_shop_over');"+f+'" onmouseout="removeClass(this.parentNode.parentNode.parentNode, \'emoji_shop_over\');"':_+=' onmouseover="'+f+'"',d+="</span></span>",o.noStickers||(d+='<a class="fl_r emoji_shop" '+_+'><div class="emoji_sprite emoji_shop_icon">'+(G.hasNewStickers?'<div class="emoji_shop_icon_badge">'+Math.abs(G.hasNewStickers)+"</div>":"")+"</div></a>"),G.showShadow()||(u+=" emoji_no_opacity"),(o.noStickers||o.hideStickersInitial)&&(u+=" emoji_no_tabs"),c=ce("div",{id:"emoji_block_"+e,className:"emoji_tt_wrap tt_down"+u,innerHTML:'<div class="emoji_block_cont"><div class="emoji_block_rel"><div class="emoji_list_cont"><div class="emoji_cats_title_helper"></div><div class="emoji_list"><div class="emoji_scroll emoji_scroll_smiles"></div><div class="emoji_scroll emoji_scroll_stickers"></div></div></div></div><div class="emoji_tabs clear_fix">'+d+"</div></div>",onmouseenter:function(t){hasClass(c,"emoji_animated")||G.ttShow(e,!1,t)},onmouseleave:function(t){hasClass(c,"emoji_animated")||G.ttHide(e,!1,t)}}),o.tt=c,G.reappendEmoji(e,c),G.emojiOver(e,geByClass1("emoji_scroll_smiles",c).firstChild),each(["emoji_tabs_l_s","emoji_tabs_r_s","emoji_tabs_wrap"],(function(){addEvent(geByClass1(this,o.tt),"DOMMouseScroll wheel",(function(t){G.tabsWheel(t,e)}))})),o.sharedTT&&(o.sharedTT.emojiTT=c),G.checkEmojiSlider(o)}if(clearTimeout(o.ttEmojiHide),!1!==G.shownId&&G.shownId!=e&&G.ttClick(G.shownId,geByClass1("emoji_smile",G.opts[G.shownId].controlsCont),!0),G.preventMouseOver=!1,o.emojiExpanded||G.emojiExpand(e,c),G.shown)G.hideTt(c),(a=geByClass1("_sticker_hints",domPN(o.txt)))&&isVisible(a)&&G.checkStickersHintsSize(a,o,!0),G.shown=!1,G.shownId=!1,o.ttShown=!1,o.emojiFocused=!1,o.emojiOvered=!1,cur.onMouseClick=!1,removeEvent(document,"keydown",G.emojiMove),removeClass(t,"emoji_smile_on"),o.onHide&&o.onHide(),G.favorite.deleteFavoriteStickerElements(e);else{if(o.needUpdateRecentStickers&&(G.updateRecentStickers(e),o.needUpdateRecentStickers=!1),!getXY(o.emojiBtn)[0]||!getXY(o.emojiBtn)[1])return;o.openedByTabKey=!!s,G.showTt(c),G.repositionEmoji(e,t,c),(a=geByClass1("_sticker_hints",domPN(o.txt)))&&isVisible(a)&&G.checkStickersHintsSize(a,o,!0),G.shownId=e,G.shown=t,cur.emojiList=geByClass1("emoji_list",c),o.ttShown=!0,o.ttShowT=vkNow(),o.emojiFocused=!0,removeEvent(document,"keydown",G.emojiMove),setTimeout((function(){cur.onMouseClick=function(t){for(var i=t.target;i;){if("im_texts"==i.id||hasClass(i,"emoji_tt_wrap")||hasClass(i,"imw_emoji_wrap"))return!1;i=i.parentNode}G.ttClick(e,!1,!0)},addEvent(document,"keydown",G.emojiMove)}),0),addClass(t,"emoji_smile_on"),o.emojiScroll&&o.emojiExpanded&&(o.emojiScroll.update(),browser.msie&&0===o.curTab&&o.emojiOvered&&G.scrollToListEl(e,o.emojiOvered)),o.currentPeerId=void 0,G.tabSwitch(o.curTab,o.curTab,e),o.onRecentEmojiUpdate&&o.onRecentEmojiUpdate(!0),o.onShow&&o.onShow(),o.tt.classList.toggle("emoji_tt_can_gift",!("im"===cur.module&&cur.gid))}return G.hideStickersStoreNotification(),G.noNewStickers=!0,o.noStickersStore?addClass(geByClass1("emoji_tabs","emoji_block_"+e),"emoji_tabs_no_store"):removeClass(geByClass1("emoji_tabs","emoji_block_"+e),"emoji_tabs_no_store"),cancelEvent(n)}},curEmojiKeys:{},curEmojiRecent:{},loadingPeerInfo:{},getPeerId(e){var t=G.opts[e];if(window.curFastChat){var i=window.curFastChat.activeBox;if(i&&i.content&&i.content.compareDocumentPosition(t.emojiBtn)&Node.DOCUMENT_POSITION_CONTAINED_BY)return window.curFastChat.peer}return cur.peer},getPeerInfo(e){if(this.loadingPeerInfo[e])return this.loadingPeerInfo[e];if(!(0,w.isUserPeer)(e))return Promise.resolve(null);var t=new Promise(((t,i)=>ajax.post("stickers.php",{act:"get_peer_info",peer_id:e},{onDone:i=>{this.loadingPeerInfo[e]=null,t(i)},onFail(){this.onDone(null)}})));return this.loadingPeerInfo[e]=t,t},emojiLoadMore:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,r=G.opts[e];r.emojiMoreSt||(r.emojiMoreSt=1,G.emojiFetchMore(t).then(((t,n)=>{G.updateEmojiList(t,n,e,r),(0,k.isFunction)(i)&&i()}),(e=>{console.error("Emoji.emojiLoadMore error ",e),r.emojiMoreSt=0})),G.curEmojiRecent&&r.onRecentEmojiUpdate&&r.onRecentEmojiUpdate())},emojiFetchMore(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((t,i)=>{e.act="get_emoji_list",G.stickerPacksToLoad&&(e.sticker_packs_to_load=G.stickerPacksToLoad.join(",")),G.hasNewStickers<0&&(e.new_shown=1);var r=Object.assign(e.sizes||{},G.stickerSizes);e.sizes=r&&Object.keys(r).join(","),ajax.post("al_im.php",e,{onDone:function(e,i,n,s,o,a){if(G.buildStickersIndex(e),void 0!==e[G.TAB_FAVORITE_STICKERS]){var c=e[G.TAB_FAVORITE_STICKERS];G.tabDefaultId=G.TAB_FAVORITE_STICKERS,G.favoriteAvailable=!0,G.favoriteRemindOn=!!c.remind_on,G.favoriteRemindOff=!!c.remind_off,G.favoriteLimit=c.limit,G.favoriteLimitNoticed=c.limit_noticed,G.sendHintsLogHash=o,u.default.setIntroViewed(a)}s&&extend(cur.lang,s),Object.assign(G.stickerSizes,r),n?window.stManager.add([jsc("web/stickers.js")],(()=>{t(e,i)})):t(e,i)},onFail:function(e){return i(e),!0}})}))},emojiPreloadMore(e,t){G.isStickersPreloading||(G.isStickersPreloading=!0,G.emojiFetchMore(e).then(((e,i)=>{G.stickers=e,G.stickers[G.TAB_RECENT_STICKERS]&&ls.set("recent_stickers",G.stickers[-1]),G.stickers[G.TAB_FAVORITE_STICKERS];var r=G.emojiGetRecentFromStorage();r?G.curEmojiRecent=G.filterEmoji(r):G.emojiOldRecentPrepare(i),t&&t()}),(e=>{console.error("Emoji.emojiPreloadMore error ",e)})).finally((()=>{G.isStickersPreloading=!1})))},buildStickersIndex:function(e){var t={};if(e)for(var i in e)if(e.hasOwnProperty(i)&&i>0&&e[i].stickers)for(var r=e[i].stickers,n=r.length;n--;){var s=r[n];t[s[0]]={sticker:s,packId:i}}G.stickersById=t},updateEmojiList:function(e,t,i,r){G.stickers=e,r.emojiMoreSt=0,G.stickers[-1]&&(ls.set("recent_stickers",G.stickers[-1]),G.updateRecentEmoji(i)),G.stickers[-2],r.allEmojiId=0,r.sharedTT&&(r.sharedTT.emojiAllId=0),G.onStickersLoad&&(r.afterLoad=1),G.onStickersLoad&&window.emojiStickers&&(G.onStickersLoad(),G.onStickersLoad=!1);var n=G.emojiGetRecentFromStorage();n?G.curEmojiRecent=G.filterEmoji(n):(G.emojiOldRecentPrepare(t,i),G.updateEmojiCont(i)),G.updateRecentEmoji(i),r.onRecentEmojiUpdate&&r.onRecentEmojiUpdate(!0)},filterEmoji:function(e){var t=Object.keys(e);e:for(var i in o.EMOJI_SECTIONS_CODES)if(o.EMOJI_SECTIONS_CODES.hasOwnProperty(i))for(var r in o.EMOJI_SECTIONS_CODES[i])if(o.EMOJI_SECTIONS_CODES[i].hasOwnProperty(r)){var n=o.EMOJI_SECTIONS_CODES[i][r],s=t.indexOf(n);if(-1!=s&&(t.splice(s,1),0==t.length))break e}var a={};for(var c in e)e.hasOwnProperty(c)&&-1==t.indexOf(c)&&(a[c]=e[c]);return t.length>0&&G.setRecentEmojiList(a),a},emojiGetRecentFromStorage:function(){try{return JSON.parse(localStorage.getItem("emoji_recent_list"))}catch(e){return!1}},emojiOldRecentPrepare:function(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i],n=void 0,s=void 0;isString(r)?(n=1,s=r):(n=r,s=i),t[s]=n}G.setRecentEmojiList(G.filterEmoji(t))},getRecentEmojiSorted:function(){var e=[];for(var t in G.curEmojiRecent)if(G.curEmojiRecent.hasOwnProperty(t)){var i=G.curEmojiRecent[t];e.push([t,i])}e.sort((function(e,t){return t[1]-e[1]}));var r=[];for(var n in e)e.hasOwnProperty(n)&&r.push(e[n][0]);return r.slice(0,20)},incrRecentEmojiRate:function(e,t){G.emojiRecentRateTime||(G.emojiRecentRateTime=Date.now()/1e3-6);var i=Date.now()/1e3-G.emojiRecentRateTime;if(i>=6){var r=Math.min(100,Math.floor(i/6));for(var n in G.curEmojiRecent)if(G.curEmojiRecent.hasOwnProperty(n)){if(n==t)continue;G.curEmojiRecent[n]*=Math.pow(.998076,r)}G.emojiRecentRateTime+=6*r}G.curEmojiRecent[t]||(G.curEmojiRecent[t]=0),G.curEmojiRecent[t]+=1;var s=G.getRecentEmojiSorted();o.EMOJI_SECTIONS_CODES[-1]=s,s.length>=20&&-1==s.indexOf(t)&&(s.splice(-1),s.push(t));var a={};for(var c in s)if(s.hasOwnProperty(c)){var l=s[c];a[l]=G.curEmojiRecent[l]}G.setRecentEmojiList(a),window.Notifier&&Notifier.lcSend("recent_emoji_set",a)},setRecentEmojiList:function(e){localStorage.setItem("emoji_recent_list",JSON.stringify(e)),G.curEmojiRecent=e},updateEmojiCont:function(e){var t=G.opts[e];t&&0==t.curTab&&(val(geByClass1("emoji_scroll_smiles",t.tt),G.getInitEmojiContent(e)),G.updateEmojiCatTitle(e))},ttEmojiList:function(e,t){var i="",r=G.emojiGetRecentFromStorage();r&&G.setRecentEmojiList(r),o.EMOJI_SECTIONS_CODES[-1]=G.getRecentEmojiSorted();var n=t||G.SORTED_EMOJI_SECTIONS_CODES;for(var s in n)if(n.hasOwnProperty(s)){var a=n[s];i+=G.getEmojiCategoryHtml(e,a)}return i},getInitEmojiContent:function(e){G.setEmojiLastAddedCategoryIdx(e,1);return G.ttEmojiList(e,[-1,1])},getEmojiCategoryHtml:function(e,t){var i="",r=o.EMOJI_SECTIONS_CODES[t];if(!r.length)return i;var n=-1==t?"recent":t,s='<div class="emoji_cat_title_helper" data-id="'+t+'" id="emoji_recent_list'+e+"_"+t+'"><div class="emoji_cat_title">'+(0,v.getLang)("global_emoji_cat_"+n)+"</div></div>";return i+=s+=G.emojiGetCatCont(e,r)},getEmojiLastAddedCategoryIdx:function(e){return G.opts[e].lastLoadedEmojiCategoriesIdxes[e]},setEmojiLastAddedCategoryIdx:function(e,t){G.opts[e].lastLoadedEmojiCategoriesIdxes[e]=t},addNextEmojiCategoty:function(e){var t=G.opts[e],i=t.tt,r=G.getEmojiLastAddedCategoryIdx(e);if(!t.emojiCategoryAdding&&!t.allEmojiLoaded)if(t.emojiCategoryAdding=!0,r){var n=geByClass1("emoji_scroll_smiles",i);if(r++,G.SORTED_EMOJI_SECTIONS_CODES.length>r){var s=G.SORTED_EMOJI_SECTIONS_CODES[r];n.insertAdjacentHTML("beforeEnd",G.getEmojiCategoryHtml(e,s)),G.setEmojiLastAddedCategoryIdx(e,r),t.emojiScroll.update()}else t.allEmojiLoaded=!0;t.emojiCategoryAdding=!1}else debugLog("No emoji last category idx")},hideTt:function(e){removeClass(e,G.SHOWN_TT_CLS)},showTt:function(e){addClass(e,G.SHOWN_TT_CLS)},emojiGetCatCont:function(e,t){for(var i="",r="",n=t.length-1,s=0;s<=n;s++)r+=G.emojiWrapItem(e,t[s],s),(s>0&&s%10==9||s>=n)&&(i+='<div class="emoji_smiles_row">'+r+"</div>",r="");return i},updateRecentEmoji:function(e){var t=G.getRecentEmojiSorted(),i=G.emojiGetCatCont(e,t),r=ge("emoji_recent_list"+e+"_-1");if(r){for(var n=r.nextSibling;n&&(n=n.nextSibling,hasClass(n.previousSibling,"emoji_smiles_row"));)re(n.previousSibling);for(var s=ce("div",{innerHTML:i}),o=r.nextSibling,a=r.parentNode;n=s.firstChild;)a.insertBefore(n,o)}},updateRecentStickers:function(e){var t=G.opts[e];if(G.stickers[G.TAB_RECENT_STICKERS]&&t&&t.emojiExpanded){var i=ge("emoji_recent_stickers_cont"+e);if(i){val(i,"");for(var r=G.stickers[G.TAB_RECENT_STICKERS].stickers,n=cf(),s=0;s<r.length;s++){var o=G.render.sticker(e,G.TAB_RECENT_STICKERS,r[s]);n.appendChild(o);var a=68*Math.ceil((s+1)/4);t.needLoadStickers.unshift([e+"_"+G.TAB_RECENT_STICKERS+"_"+r[s][0],a])}i.appendChild(n),G.updateStickersPos(e)}}},findStickerIndex:function(e,t){if(e)for(var i=e.stickers,r=i.length;r--;)if(String(i[r][0])===String(t))return r;return-1},findSticker:function(e,t){var i=G.findStickerIndex(e,t);if(-1!==i)return e.stickers[i]},findFavoriteStickerIndex:function(e){return G.findStickerIndex(G.stickers[G.TAB_FAVORITE_STICKERS],e)},findFavoriteSticker:function(e){return G.findSticker(G.stickers[G.TAB_FAVORITE_STICKERS],e)},findRecentStickerIndex:function(e){return G.findStickerIndex(G.stickers[G.TAB_RECENT_STICKERS],e)},findRecentSticker:function(e){return G.findSticker(G.stickers[G.TAB_RECENT_STICKERS],e)},findPackSticker:function(e){if(G.stickersById&&G.stickersById.hasOwnProperty(e))return G.stickersById[e].sticker},isStickersLoaded:function(){if(G.stickers)for(var e in G.stickers)if(G.stickers.hasOwnProperty(e)&&e!==String(G.TAB_RECENT_STICKERS))return!0;return!1},tabs:{favoriteTabContent:function(e,t){var i=G.TAB_FAVORITE_STICKERS,r="emoji_tab emoji_tab_img_cont emoji_tab_favorite emoji_tab_"+i;if(cur.stickersTab===i&&(r+=" emoji_tab_sel"),0===t&&G.isStickersLoaded()){var n=G.stickers[i];t=n?n.stickers.length:0}return 0===t&&(r+=" unshown"),'<a class="'+r+'" onmousedown="'+e+'" onclick="return cancelEvent(event)"><span class="emoji_tab_icon emoji_sprite emoji_tab_icon_favorite"></span></a>'}},favorite:{reminder:function(e){var t=hasClass(e,"on"),i=t?"favoriteRemindOff":"favoriteRemindOn";if(!G[i]){var r={text:function(){return(0,v.getLang)(t?"purchases_stickers_favorite_rm_tt":"purchases_stickers_favorite_add_tt")},black:1,hidedt:100,typeClass:"tt_black",noZIndex:!0,shift:[10,8]},n=domClosest("ui_scroll_container",e);r.appendEl=n;var s=domClosest("ui_scroll_overflow",e),o=getXYRect(e),a=getXYRect(s),c=o.top-a.top,l=(a.right,o.right,a.bottom-o.bottom),d=o.left-a.left,u=(a.width||a.right-a.left)/2;(!vk.rtl&&d>u||vk.rtl&&d<u)&&(r.needLeft=!0,r.shift[0]=9),r.forcetodown=c<G.FAV_ICON_TT_MIN_HEIGHT,r.forcetoup=l<G.FAV_ICON_TT_MIN_HEIGHT,(0,g.showTooltip)(e,r),G[i]=!0,ajax.post("stickers.php",{act:"tt_favorite_off",tt_type:t?1:2})}},addFavoriteSticker:function(e,t,i){var r=G.stickers[G.TAB_FAVORITE_STICKERS];if(r){var n=G.findPackSticker(t);if(n){n[4]=1,r.stickers.unshift(n);var s=G.opts[e],o=s.deletedFavoriteStickers;for(s.deletedFavoriteStickers=[t];r.stickers.length>G.favoriteLimit;)G.favorite.deleteFavoriteSticker(e,r.stickers[r.stickers.length-1][0]);G.favorite.deleteFavoriteStickerElements(e),s.deletedFavoriteStickers=o;var a=G.findRecentSticker(t);a&&(a[4]=1);var c=ge("emoji_favorite_stickers_cont"+e);if(c){var l=G.opts[e].emojiScroll.data.scrollHeight,d=G.opts[e].emojiScroll.data.scrollTop,u=ge("emoji_sticker_item"+e+"_"+G.TAB_FAVORITE_STICKERS+"_"+t);if(!u){u=G.render.sticker(e,G.TAB_FAVORITE_STICKERS,n),G.render.stickerContent(e,u,!1);var _=domFC(c);_?domInsertBefore(u,_):c.appendChild(u),G.opts[e].emojiScroll.update();var f=G.opts[e].emojiScroll.data.scrollHeight-l;G.opts[e].emojiScroll.scrollTop(d+f),G.updateStickersPos(e)}}var m=geByClass1("emoji_tab_"+G.TAB_FAVORITE_STICKERS);if(hasClass(m,"unshown")&&(G.opts[e].curTab===G.TAB_FAVORITE_STICKERS&&removeClass(geByClass1("emoji_tab_"+G.TAB_RECENT_STICKERS),"emoji_tab_sel"),removeClass(m,"unshown")),G.favorite.updateFavoriteStickerElements(e,t,!0),G.opts[e].deletedFavoriteStickers.length>0){var h=indexOf(G.opts[e].deletedFavoriteStickers,t);-1!==h&&G.opts[e].deletedFavoriteStickers.splice(h,1)}}}},deleteFavoriteSticker:function(e,t,i){var r=G.stickers[G.TAB_FAVORITE_STICKERS];if(r){var n=G.findFavoriteStickerIndex(t);if(-1!==n){if(r.stickers.splice(n,1),G.opts[e].deletedFavoriteStickers.push(t),0===r.stickers.length&&i)addClass(geByClass1("emoji_tab_"+G.TAB_FAVORITE_STICKERS),"unshown"),domData(i.parentElement,"pack-id")===String(G.TAB_FAVORITE_STICKERS)&&addClass(geByClass1("emoji_tab_"+G.TAB_RECENT_STICKERS),"emoji_tab_sel");G.favorite.updateFavoriteStickerElements(e,t,!1);var s=G.findRecentSticker(t);s&&(s[4]=0);var o=G.findPackSticker(t);o&&(o[4]=0)}}},deleteFavoriteStickerElement:function(e,t){re("emoji_sticker_item"+e+"_"+G.TAB_FAVORITE_STICKERS+"_"+t)},deleteFavoriteStickerElements:function(e){var t=G.opts[e];t.deletedFavoriteStickers.length>0&&(t.deletedFavoriteStickers.forEach((function(t){G.favorite.deleteFavoriteStickerElement(e,t)})),t.deletedFavoriteStickers=[],G.updateStickersPos(e))},deleteFavoriteStickerElementsAsync:function(e){var t=G.opts[e];t.deleteFavoriteStickersTimeout||(t.deleteFavoriteStickersTimeout=setTimeout((function(){G.favorite.deleteFavoriteStickerElements(e),t.deleteFavoriteStickersTimeout=null}),G.DELETE_FAV_STICKER_ELEMENTS_DELAY))},updateFavoriteStickerElements:function(e,t,i){geByClass("sticker_item_"+t).forEach((function(e){domData(e,"fav",i?"1":null),toggleClass(e,"faved",i),toggleClass(geByClass1("emoji_sticker_item_fav",e),"on",i)}))}},updateEmojiCatTitle:function(e){var t=G.opts[e];if(t&&t.emojiScroll){var i,r,n,s=ge("emoji_block_"+e),o=geByClass("emoji_cat_title_helper",s),a=t.emojiScroll.data.scrollTop,c=geByClass1("emoji_cats_title_helper",t.tt);if(o.length){var l=o[0];i=G.getSizeCached(l)[1]}for(var d=o.length-1;d>=0;d--)if(a>o[d].offsetTop-i){r=o[d],n=d;break}if(!r)return debugLog("title not found");var u=intval(attr(r,"data-id"));if(t.curEmojiCatId!=u){t.curEmojiCatId=u;var _=[r],f=o[n-1];f&&(addClass(f,"emoji_cat_title_fix"),setStyle(f.firstChild,"transform","translateY("+(r.offsetTop-f.offsetTop-i)+"px)"));for(var m=r.nextSibling;m;)hasClass(m,"emoji_cat_title_fix")&&_.push(m),m=m.nextSibling;for(var h in _)_.hasOwnProperty(h)&&(removeClass(_[h],"emoji_cat_title_fix"),setStyle(_[h].firstChild,"transform","translateY(0px)"));val(c,""),t.emojiTitleHelperIsSet=0}!t.emojiTitleHelperIsSet&&a>=r.offsetTop&&a>0?(val(c,val(r)),t.emojiTitleHelperIsSet=1):t.emojiTitleHelperIsSet&&(a<r.offsetTop||0==a)&&(val(c,""),t.emojiTitleHelperIsSet=0)}},emojiWrapItem:function(e,t,i){var r,n=G.cssEmoji[t];r=n?' title="'+n[1]+'"':"";var s="";return browser.mobile||(s=' onmouseover="return Emoji.emojiOver('+e+', this, true);"'),'<a class="emoji_smile_cont '+("2764"!=t&&i&&i<54?"emoji_smile_shadow":"")+'" '+r+" onmousedown=\"Emoji.addEmoji(Emoji.shownId, '"+t+'\', this); return cancelEvent(event);" onclick="return cancelEvent(event);" '+s+'><div class="emoji_bg"></div><div class="emoji_shadow"></div>'+G.getEmojiHTML(t,!1,!1,!0)+"</a>"},reappendEmoji:function(e,t){var i=G.opts[e];i&&i.rceCont&&(i.addMediaBtn?i.sendWrap.insertBefore(i.rceCont,i.addMediaBtn):i.sendWrap.appendChild(i.rceCont)),t&&(i.ttWrap?i.ttWrap.appendChild(t):i.emojiWrap?i.emojiWrap.appendChild(t):i.obj.appendChild(t),clearTimeout(cur.ttEmojiHide),G.hideTt(t))},ttCalcHeight:function(e,t,i){window.headH=window.headH||ge("page_header")&&G.getSizeCached(ge("page_header"))[1]||0;var r=(window.pageNode&&window.browser.mozilla?Math.min(getSize(pageNode)[1],window.lastWindowHeight):window.lastWindowHeight)||getScroll()[3],n=window.scrollGetY?scrollGetY():getScroll()[1],s=getXY(t)[1],o=G.getSizeCached(t)[1],a=geByClass1("emoji_list",i),c=G.opts[e].emojiSmileHeigh,l=window.headH,u=G.opts[e].emojiRowsCount;isAncestor(t,pageNode)||(l=0),setStyle(a,{height:u*c+8});for(var _,f,m,h,p=n+l,g=n+r,v=i,k=getSize(i)[1];v!==bodyNode&&(v=(0,d.domClosestOverflowHidden)(v));){var S=getXY(v)[1];p=Math.max(p,S),g=Math.min(g,S+getSize(v)[1])}for(m=g-s-o-9,_=(f=s-9-p)<k&&m<k?f>=m:f>=k,G.opts[e].forceUp&&(_=!0),h=_?f:m;h<k&&u>3;)u--,k-=c;G.opts[e].emojiRowsCount=u,G.opts[e].emojiSmileHeigh=c,setStyle(a,{height:u*c+8}),toggleClass(i,"tt_down",_),toggleClass(i,"tt_up",!_)},repositionEmoji:function(e,t,i){var r,n=G.opts[e];if(n){if(i.parentNode&&getXY&&getStyle&&setStyle&&geByClass&&(r=geByClass1("emoji_rpointer",i))){var s=parseInt(getStyle(i,"width")),o=getXY(t)[0],a=parseInt(getStyle(t,"width")),c=getXY(i.parentNode)[0];o+a/2<283?(setStyle(i,"left",-s-c),setStyle(r,"left",o+a/2-20+"px")):(setStyle(i,"left",""),setStyle(r,"left",""))}else setStyle(i,"left","");var l=geByClass1("emoji_list",i),d=geByClass1("emoji_smile_cont",l);if(G.opts[e].emojiSmileHeigh=d&&G.getSizeCached(d)[1]||26,G.opts[e].emojiRowsCount=9,G.ttCalcHeight(e,t,i),n.ttWrap){var u=getSize(n.ttWrap)[0]-(getXY(n.emojiBtn)[0]-getXY(n.ttWrap)[0]);setStyle(i,"right",u-n.ttDiff+"px")}}},emojiOver:function(e,t,i){if(browser.mobile||i&&G.preventMouseOver)return!0;var r=G.opts[e];addClass(t,"emoji_over"),r.emojiOvered&&r.emojiOvered!=t&&removeClass(r.emojiOvered,"emoji_over"),r.emojiOvered=t},emojiExpand:function(e,t){var i=G.opts[e];addClass(t,"emoji_expanded"),G.emojiLoadMore(e),i.emojiScroll?i.emojiScroll.update():(i.emojiScroll=new uiScroll(geByClass1("emoji_list",t),{theme:"default emoji no_transition",shadows:!0,global:!0,noForceReFlow:!0,ondragstart:function(){i.scrolling=!0},ondragstop:function(){i.scrolling=!1,(0,k.isFunction)(i.afterScrollFn)&&i.afterScrollFn()},onscrollstart:function(){window.tooltips&&tooltips.destroyAll(),i.scrollStarted=!0},onupdate:function(t){i.curTab==G.TAB_EMOJI?G.updateEmojiCategories(t,i,e):G.updateShownStickers(e)}}),i.imagesLoader=i.imagesLoader||imagesLoader(i.emojiScroll.scroller,{use_iframe:!0,need_load_class:"emoji_need_load"}),i.sharedTT&&(i.sharedTT.emojiScroll=i.emojiScroll)),i.emojiExpanded=!0},updateEmojiCategories:function(e,t,i){e.data.scrollBottom-G.BOTTOM_REST_FOR_ADD_EMOJI_CATEGORY<=0&&t.scrollStarted&&setTimeout((function(){G.addNextEmojiCategoty(i),G.updateEmojiCatTitle(i)}),0),G.updateEmojiCatTitle(i)},updateShownStickers:function(e,t){var i=G.opts[e];if(i.emojiScroll&&i.stickersSplitersPos){i.needLoadStickers||(i.needLoadStickers=[]);var r=i.emojiScroll.data.scrollTop,n=r,s=r+i.emojiScroll.data.viewportHeight,o=i.needLoadStickers;clearTimeout(i.preloadStickersTimer);for(var a=[],c=0;c<o.length;c++){var l=o[c];if(l[1]+72>=n&&l[1]<=s){var d=ge("emoji_sticker_item"+l[0]);if(!d||hasClass(d,"__loaded"))continue;var u=G.render.stickerContent(e,d,!0);a.push([u,l[0]])}}if(G.loadStickers(e,a),a.length||G.preloadStickers(e),!(t||i.scrollAnimation||G.onStickersLoad)){for(var _=-1,f=0;f<i.stickersSplitersPos.length;f++){var m=i.stickersSplitersPos[f];if(!(m[1]-30<r))break;_=m[0]}_!=G.TAB_FAVORITE_STICKERS&&G.favorite.deleteFavoriteStickerElementsAsync(e),i.curTab!=_&&G.scrollToTab(_,e)}}},loadStickers:function(e,t){var i=G.opts[e];if(t.length){for(var r={},n=0;n<t.length;n++){var s=t[n][0]+":"+t[n][1];i.imagesLoading[s]&&(r[s]=i.imagesLoading[s],delete i.imagesLoading[s],t.splice(n,1),n--)}for(var o in i.imagesLoading)if(i.imagesLoading.hasOwnProperty(o)){var a=i.imagesLoading[o];if(!a)return;a.src=""}for(var c in i.imagesLoading=r,t)if(t.hasOwnProperty(c)){var l=t[c][0]+":"+t[c][1];i.imagesLoading[l]=i.imagesLoader.iloader.add(t[c][0],G.onStickerLoaded,e+":"+t[c][1])}}},preloadStickers:function(e){var t=G.opts[e];t.imagesLoading&&Object.keys(t.imagesLoading).length>0||(clearTimeout(t.preloadStickersTimer),t.preloadStickersTimer=setTimeout((function(){var i=t.emojiScroll.data.scrollTop,r=t.emojiScroll.data.viewportHeight,n=i+r,s=i-r,o=i,a=n,c=n+r,l=geByClass1("emoji_scroll_stickers",t.tt);if(isVisible(l)){for(var d=l.firstChild,u=[];d;){if(hasClass(d,"emoji_sticker_item")&&!hasClass(d,"__loaded")){var _=d.offsetTop;if(_>=s&&_<=o||_>=a&&_<=c){var f=d.id.replace("emoji_sticker_item",""),m=G.render.stickerContent(e,d,!0);u.push([m,f])}}d=d.nextSibling}G.loadStickers(e,u)}}),50))},onStickerLoaded:function(e){var t=String(this).split(":"),i=t[1],r=intval(t[0]),n=G.opts[r],s=ge("emoji_sticker_item"+i);if(s){var o=geByTag1("img",s);if(o){addClass(s,"__loaded"),attr(o,"src",e),delete G.opts[r].imagesLoading[e+":"+i];for(var a=0;a<n.needLoadStickers.length;a++){if(i==n.needLoadStickers[a][0]){n.needLoadStickers.splice(a,1);break}}Object.keys(G.opts[r].imagesLoading).length||G.preloadStickers(r)}}},emojiMove:function(e){var t=G.shownId,i=G.opts[t];if(G.shown&&i&&i.emojiFocused&&i.openedByTabKey){var r=null;if(i.emojiOvered)switch(e.keyCode){case KEY.LEFT:r=G.getEmojiEl(i.emojiOvered,"left"),cancelEvent(e);break;case KEY.RIGHT:r=G.getEmojiEl(i.emojiOvered,"right"),cancelEvent(e);break;case KEY.UP:r=G.getEmojiEl(i.emojiOvered,"up");break;case KEY.DOWN:r=G.getEmojiEl(i.emojiOvered,"down");break;case KEY.ENTER:if(!G.emojiEnter(t,e))return cancelEvent(e),!1;break;default:return!0}else r=G.getFirstEmojiEl(t);if(r)return G.preventMouseOver=!0,G.emojiOver(t,r),G.scrollToListEl(t,r),!1}return!0},scrollToListEl:function(e,t){var i=G.opts[e];if(i&&i.emojiScroll){var r=t.offsetTop,n=Math.max(r+30-i.emojiScroll.data.viewportHeight,Math.min(i.emojiScroll.data.scrollTop,r-30));i.emojiScroll.data.scrollTop!=n&&i.emojiScroll.scrollTop(n)}},anim:function(e,t){clearInterval(cur._imAnim);var i=Math.floor(300/13),r=0,n=domLC(e),s=domFC(e),o=t?0:45,a=t?45:0,c=t?1:0,l=t?0:1;cur._imAnim=setInterval((function(){var d=++r>=i?a:o+1.95*r*(t?1:-1),u=d-45,_=r>=i?l:c+.043333333333333335*r*(t?-1:1),f=1-_;n.style.WebkitTransform=n.style.OTransform=n.style.transform="rotate("+d+"deg)",s.style.WebkitTransform=s.style.OTransform=s.style.transform="rotate("+u+"deg)",n.style.opacity=_,s.style.opacity=f,r>=i&&(clearInterval(cur._imAnim),(t?addClass:removeClass)(e,"emoji_smile_on"),n.style.WebkitTransform=n.style.OTransform=n.style.transform=s.style.WebkitTransform=s.style.OTransform=s.style.transform=n.style.opacity=s.style.opacity="")}),13)},tplSmile:function(e){return'<div class="emoji_smile_wrap _emoji_wrap"><div class="emoji_smile _emoji_btn" title="'+e+'" onmouseenter="return Emoji.show(this, event);" onmouseleave="return Emoji.hide(this, event);" onclick="return cancelEvent(event);"><div class="emoji_smile_icon"></div></div></div>'},emojiToHTML:s.emojiToHTML,emojiReplace:s.emojiReplace,emojiRegex:(0,r.emojiRegex)(),getCode:function(e){var t=!1;if("emoji_css"==e.className)t=e.getAttribute("emoji");else if(-1!=e.className.indexOf("emoji")){var i=e.src&&e.src.match(/\/([a-f0-9*]+)(_2x)?.png/);t=i?i[1]:e.getAttribute("emoji")}return t},showProductSettings(e){(0,b.previewStickerProduct)(e,{settings:!0})},updatePeerInfo(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=G.opts[e];if("im"===cur.module&&cur.gid)this.renderPeerInfo(e,null);else{var r=this.getPeerId(e);(r!==i.currentPeerId||t)&&(i.currentPeerId=r,r?(i.tt.classList.add("emoji_tt_peer_info_loading"),this.getPeerInfo(r).then((t=>{i.tt.classList.remove("emoji_tt_peer_info_loading"),r===i.currentPeerId&&this.renderPeerInfo(e,t)}))):this.renderPeerInfo(e,null))}},renderPeerInfo(e,t){var i=G.opts[e];if(t){i.tt.classList.remove("emoji_tt_peer_info_unavailable");var r=t.product_ids.reduce(((e,t)=>(e[t]=1,e)),{});i.tt.querySelectorAll(".emoji_stickers_pack_peer_info").forEach((e=>{var i=e.dataset.productId;if(r.hasOwnProperty(i)){var n=void 0!==e.dataset.isStyle;e.innerHTML=`\n        <img\n          class="emoji_stickers_pack_peer_info__photo"\n          src="${t.photo}"\n          width="16"\n          height="16"\n          loading="lazy"\n        />\n        <div\n          class="emoji_stickers_pack_peer_info__purchased_icon"\n        >\n          ${(0,L.getIcon12CheckCircleFill)().icon}\n        </div>\n        <div\n          class="emoji_stickers_pack_peer_info__tooltip_overlay"\n          data-tooltip-text="${n?t.tooltip_style:t.tooltip_pack}"\n          onmouseover="Emoji.showPeerInfoTooltip(event);"\n        ></div>\n      `}else e.innerHTML=""}))}else i.tt.classList.add("emoji_tt_peer_info_unavailable")},showPeerInfoTooltip(e){(0,g.showTooltip)(e.target,{text:e.target.dataset.tooltipText,center:!0,black:!0,shift:[4,8],appendEl:e.target.closest(".emoji_block_cont")})},getTabCont:function(e,t){var i="";if(t){var r,n="",s="",o=G.opts[e].forceStickerPack,a=H(window.emojiStickers);try{for(a.s();!(r=a.n()).done;){var c=r.value,l=c[0],d=l===G.TAB_RECENT_STICKERS,u=l===G.TAB_FAVORITE_STICKERS,_=c[1],f=c[4]&&o==l;if(_||f){var m=c[8];if(G.stickers.hasOwnProperty(l)){var h=G.stickers[l],p=h.stickers,g=h.title,k=h.base_id,w=h.can_gift,y='<div class="clear emoji_stickers_spliter" id="emoji_tab_cont_'+l+"_"+e+'"></div>';if(d)y+='<div class="emoji_recent_stickers_cont" id="emoji_recent_stickers_cont'+e+'">';else if(u)y+='<div class="emoji_favorite_stickers_cont" id="emoji_favorite_stickers_cont'+e+'">';else{if(y+=`\n        <div class="clear emoji_stickers_pack_header">\n          <div class="emoji_stickers_pack_header_main">\n            <div class="emoji_stickers_pack_title">${g}</div>`,k&&!vk.widget)y+=`<a class="${(0,S.classNames)("emoji_stickers_pack_select_style",{"emoji_stickers_pack_select_style--new":m})}" href="javascript:void(0);" onclick="Emoji.showProductSettings(${k});" title="${(0,v.getLang)("purchases_stickers_select_style")}">${(0,x.getIcon20GearOutline)().icon}</a>`;if(y+='\n          </div>\n          <div class="emoji_stickers_pack_header_aside">',w&&!vk.widget)y+=`\n            <div\n              class="emoji_stickers_pack_peer_info"\n              data-product-id="${l}"\n              ${k&&k!==l?"data-is-style":""}\n            ></div>\n            <a\n              class="emoji_stickers_pack_gift"\n              onclick="Emoji.giftStickerToCurrentPeer(${e}, ${l}, event, { sticker_referrer: &quot;stickers_keyboard2&quot; });"\n            >\n              ${(0,N.getIcon20GiftOutline)().icon}\n            </a>`;y+="\n          </div>\n        </div>"}var E,C=H(p);try{for(C.s();!(E=C.n()).done;){var T=E.value;y+=G.render.stickerRs(e,l,T)}}catch(e){C.e(e)}finally{C.f()}d?n=y+"</div>":u?s=y+"</div>":f?i=y+i:i+=y}}}}catch(e){a.e(e)}finally{a.f()}i=s+n+i}else i=G.ttEmojiList(e);return i},updateStickersCont:function(e){var t=G.opts[e],i=G.getTabCont(e,G.tabDefaultId);geByClass1("emoji_scroll_stickers",t.tt).innerHTML=i,t.initedStickers=1,t.imagesLoading=[],clearTimeout(t.preloadStickersTimer),G.updateStickersPos(e)},updateStickersPos:function(e){for(var t=G.opts[e],i=[],r=[],n=geByClass1("emoji_scroll_stickers",t.tt).firstChild,s=!1,o=!1;n;){if(!s&&hasClass(n,"emoji_recent_stickers_cont")?(n=n.firstChild,s=!0):!o&&hasClass(n,"emoji_favorite_stickers_cont")&&n.firstChild&&(n=n.firstChild,o=!0),hasClass(n,"emoji_sticker_item")){var a=n.id.replace("emoji_sticker_item","");i.push([a,n.offsetTop])}else if(hasClass(n,"emoji_stickers_spliter")){var c=n.id.replace("emoji_tab_cont_","").split("_");r.push([intval(c[0]),n.offsetTop])}(!n.nextSibling&&s||!n.nextSibling&&o)&&(n=n.parentNode),n=n.nextSibling}t.needLoadStickers=i,t.stickersSplitersPos=r},stickerItem:function(){return'<a id="emoji_sticker_item%optId%_%selId%_%stickerId%" data-opt-id="%optId%" data-sticker-id="%stickerId%" data-pack-id="%selId%" data-src="%stickerUrl%" data-fav="%fav%" data-fav-hash="%favHash%" class="emoji_sticker_item sticker_item_%stickerId% %favClass%" onclick="Emoji.stickerClick(%optId%, %stickerId%, %size%, \'%stickerUrl%\', this, \'%referrer%\');"></a>'},stickerItemAnimation:function(){return'<a id="emoji_sticker_item%optId%_%selId%_%stickerId%" data-opt-id="%optId%" data-uniq-id="%uniqId%" data-sticker-id="%stickerId%" data-pack-id="%selId%" data-src="%stickerUrl%" data-animation-path="%animationUrl%" data-fav="%fav%" data-fav-hash="%favHash%" class="emoji_sticker_item sticker_item_%stickerId% %favClass%" onclick="Emoji.stickerClick(%optId%, %stickerId%, %size%, \'%stickerUrl%\', this, \'%referrer%\');"></a>'},hintsStickerItemAnimation:function(){return'<a id="emoji_sticker_item%optId%_%selId%_%stickerId%" data-pack-id="%selId%" data-sticker-id="%stickerId%" class="emoji_sticker_item %class%" onclick="%onclick%" onmouseover="Emoji.stickerHintOver(this)" onmouseout="Emoji.stickerHintOut(this)" onmouseenter="StickersAnimation.loadAndPlaySticker(this);" data-animation-path="%animationUrl%" data-uniq-id="%uniqId%" data-sticker-id="%stickerId%"><img class="emoji_sticker_image sticker_img" src="%stickerUrl%" /></a>'},hintsStickerItem:function(){return'<a id="emoji_sticker_item%optId%_%selId%_%stickerId%" data-pack-id="%selId%" data-sticker-id="%stickerId%" class="emoji_sticker_item %class%" onclick="%onclick%" onmouseover="Emoji.stickerHintOver(this)" onmouseout="Emoji.stickerHintOut(this)"><img class="emoji_sticker_image" src="%stickerUrl%" /></a>'},tabSwitch:function(e,t,i,r){if(null!=e){var n=G.opts[i],s=n.tt;"number"==typeof e&&(e=geByClass1("emoji_tab_"+e,s));var o=geByClass1("emoji_scroll_smiles",s),a=geByClass1("emoji_scroll_stickers",s),c=geByClass1("emoji_cats_title_helper",s);if(val(c,""),n.curEmojiCatId=null,t==G.TAB_EMOJI)hide(a),show(o),show(c),n.emojiInited||(val(o,G.getInitEmojiContent(i)),n.emojiInited=!0),n.imagesLoader&&n.imagesLoader.processLoad(),n.emojiOvered&&0===n.curTab&&G.emojiOver(i,G.getFirstEmojiEl(i)),n.curTab!=G.TAB_EMOJI&&n.emojiScroll&&n.emojiScroll.scrollTop(0),G.updateRecentEmoji(i),G.updateEmojiCatTitle(i);else{hide(o),show(a),hide(c);var l=G.stickers&&clone(G.stickers);if(l&&delete l[G.TAB_RECENT_STICKERS],!window.emojiStickers||!l||isEmpty(l)||!l[t]&&t!=G.TAB_RECENT_STICKERS)G.onStickersLoad=function(){G.updateTabsOpt(i),G.tabSwitch(t,t,i,r)},G.stickersLoadingProgress(i,t,e),n.stickersInited=!1,n.curTab=null,G.emojiLoadMore(i);else{var d=window.emojiStickers.find((e=>e[0]===t));d&&d[7]&&(0,T.updateUserProductState)(t,E.UserProductStateKey.IsNew,0,!1).then((()=>{Array.from(document.querySelectorAll(`.emoji_tab_${t}`)).forEach((e=>{e.classList.remove("emoji_tab_is_new")}))})),n.stickersInited||(G.updateStickersCont(i),n.stickersInited=!0)}(n.curTab!=t||n.afterLoad)&&(G.scrollToStickerPack(i,t,n.curTab==G.TAB_EMOJI),n.afterLoad=0),G.updateShownStickers(i,!0),n.stickersInited&&G.updatePeerInfo(i)}G.onStickersLoad&&t!=G.TAB_EMOJI||G.selectTab(i,t,e)}},getFirstEmojiEl:function(e){for(var t=G.opts[e],i=geByClass1("emoji_scroll_smiles",t.tt).firstChild;i;){if(hasClass(i,"emoji_smiles_row"))return i.firstChild;i=i.nextSibling}return null},getEmojiEl:function(e,t){for(var i,r=0,n=e.parentNode,s=0,o=n.firstChild;o&&(s++,o!==e);)o=o.nextSibling;for(;e&&!i;){if("left"==t||"right"==t)(i="left"==t?e.previousSibling:e.nextSibling)||("left"==t?(t="up",s=10):(t="down",s=1));else{if("up"!=t&&"down"!=t)break;for(var a=n;a&&(a="up"==t?a.previousSibling:a.nextSibling)&&!hasClass(a,"emoji_smiles_row"););if(!a)break;if(s&&a)for(var c=0,l=a.firstChild;l&&c<s;){if(++c>=s){i=l;break}l=l.nextSibling}if(i||!a)break;i="up"==t||s&&"down"==t?a.lastChild:a.firstChild}if(++r>20){debugLog("ERR!!");break}}return i},stickerClick:function(e,t,i,r,n,s){var o=G.opts[e];if(!(Date.now()-o.ttShowT<G.CLICK_DELAY||o.preventDoubleClick&&Date.now()-o.preventDoubleClick<G.CLICK_DELAY)){G.opts[e].preventDoubleClick=Date.now();var a=parseInt(attr(n,"data-pack-id")),c=!0;if(window.emojiStickers&&each(window.emojiStickers,(function(e,t){if(t[0]==a)return c=!!t[1],!1})),c){var l=G.findRecentStickerIndex(t);-1!==l?G.stickers[G.TAB_RECENT_STICKERS].stickers.splice(l,1):G.stickers[G.TAB_RECENT_STICKERS]||(G.stickers[G.TAB_RECENT_STICKERS]={stickers:[]});var d=domData(n,"animation-path")||"",u=domData(n,"fav"),_=domData(n,"fav-hash");G.stickers[G.TAB_RECENT_STICKERS].stickers.unshift([t,i,r,d,u,_]),ls.set("recent_stickers",G.stickers[G.TAB_RECENT_STICKERS]),o.needUpdateRecentStickers=!0}o.onStickerSend&&o.onStickerSend(t,s,"animation"),statlogsValueEvent("stickers_usage",o.ref,t,s),G.ttHide(e,!1,!1,!0),o.recentSticker=t}},stickerOver:function(e,t){var i={act:"a_stickers_hover",sticker_id:e,from:cur.module};if(isObject(t.tt)&&"IMG"===t.firstChild.nodeName)return t.tt.show();ajax.post("al_im.php",i,{onDone:function(e,i){var r=(cur.tooltips||[]).length,n=["subscribe_post_tt","sticker_extra_tt","sticker_extra_tt"+r,e.image?"":"tt_text_only"];if(n=n.join(" "),e.show){var s={index:r,className:n,content:i,shift:function(){return[-138,0,-200]},hasover:1,slideX:15,showsp:150,cache:1,forcetodown:!0,no_shadow:!0,dir:"left",onShowStart:function(e){var t=e.container,i=getSize(e.container)[1];if(!(i>=225)){var r=intval((225-i)/2)+10,n=intval(getStyle(t,"top",!0));setStyle(t,"top",n+r)}}};gpeByClass("_im_peer_history_w",t)&&(s.appendParentCls="_im_peer_history_w"),(0,g.showTooltip)(t,s)}}})},selectPeer:function(e){if(void 0!==e){var t=G.opts[e];if(t.peer)return t.peer}var i=cur.peer||(cur.mbTo?cur.mbTo[0]:"");if(-3==i&&cur.wdd.imw_dd){var r=0;for(var n in cur.wdd.imw_dd.selected)cur.wdd.imw_dd.selected.hasOwnProperty(n)&&(i=cur.wdd.imw_dd.selected[n][0],r+=1);r>1&&(i="")}return i},showMyStickers:function(){cur.boxMyStickers=showBox("al_im.php",{act:"stickers_my"},{dark:1,stat:["im.css","imn.js",jsc("web/sorter.js")]})},getSelectedStickersStoreTabId(){var e=document.querySelector("#im_stickers_tabs");if(e){var t=e.querySelector(".ui_tab_sel");if(t)return M(t.parentNode.id.match(/^tbt_stickers_(.*)$/)||[],2)[1]}},showStickersStore:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=G.selectPeer(!1!==e?e:void 0),s=G.opts[e];i=A({},i,{act:"stickers_store",peer:n,box:1}),t&&(i.ref=t),cur.boxStickersStore=showBox("al_im.php",i,{dark:1,stat:["im.css","imn.js","page_help.css",jsc("web/sorter.js")],params:{onDestroy(){s&&s.onStoreHide&&s.onStoreHide(),cur.boxStickersStore=null}},onDone(){void 0!==r.scrollTop&&((0,R.getBoxLayerWrap)().scrollTop=r.scrollTop)}}),cur.boxStickersStore.reload=()=>{if(cur.boxStickersStore){var i=G.getSelectedStickersStoreTabId(),r=(0,R.getBoxLayerWrap)().scrollTop;cur.boxStickersStore.hide(),G.showStickersStore(e,t,{tab:i},{scrollTop:r})}},G.hideStickersStoreNotification(),each(geByClass("emoji_shop_icon_badge"),(function(e,t){re(t)})),G.hasNewStickers=!1},previewSticker:function(e,t,i,r){if(K()){var n=(i=i||{}).peerId||G.selectPeer(),s={recipientIds:n?[n]:[],preview_ref:i.sticker_referrer||"store"};return i.stickerId?(0,b.previewSticker)(i.stickerId,s):(0,b.previewStickerProduct)(e,s),cancelEvent(r),!1}if(i=i||{},r&&checkEvent(r))return!0;var o={act:"sticker_preview",pack_id:e},a=G.selectPeer();if(i.peer?o.peer=i.peer:a&&(o.peer=a),i.preview&&(o.preview=1),i.gift&&(o.gift=1),i.giftTo&&(o.gift_to=i.giftTo),i.stickerId&&(o.sticker_id=i.stickerId),o.sticker_referrer=i.sticker_referrer||"store",i.name){var c=nav.objLoc[0].split("/");"stickers"==c[0]&&c[1]!=i.name&&nav.setLoc({0:"stickers/"+i.name})}return cur.boxStickersPreview=showBox("al_im.php",o,{dark:1,stat:["im.css","imn.js"],onFail:function(t){if(window.cur.emojiStickersDisabled||(window.cur.emojiStickersDisabled={}),e&&(window.cur.emojiStickersDisabled[e]=!0),t)return!0}}),cancelEvent(r),!1},isStickerPackEnabled:function(e,t){var i=!1;if(!window.emojiStickers&&t)return ajax.post("al_im.php",{act:"a_stickers_list"},{onDone:function(e){window.emojiStickers=e,t()}}),0;if(!window.emojiStickers)return!1;for(var r in window.emojiStickers)if(window.emojiStickers.hasOwnProperty(r)&&window.emojiStickers[r][0]==e){i=!!window.emojiStickers[r][1];break}return i},clickSticker:function(e,t,i){if(window.cur.emojiStickersDisabled&&window.cur.emojiStickersDisabled[e])return!0;var r;if(t){if(0===(r=G.isStickerPackEnabled(e,G.clickSticker.pbind(e,t,i))))return!1;if(r){var n=!1;if(t.getAttribute("contenteditable"))n=t;else{for(var s=t.parentNode,o=!1;(s=s.parentNode)&&!hasClass(s,"js-im-page");){if(hasClass(s,"fc_tab")){o=!0;break}if(hasClass(s,"mv_chat"))break}if(!s)return!1;o?n=geByClass1("fc_editable",s):hasClass(s,"js-im-page")?n=geByClass1("_im_text"):hasClass(s,"mv_chat")&&(n=domByClass(s,"mv_chat_reply_input"))}if(n){var a=G.opts[n.emojiId];G.ttClick(n.emojiId,geByClass1("_emoji_btn",n.parentNode.parentNode),!1,!0);var c=geByClass1("emoji_tab_"+e,a.tt),l=G.stickers&&clone(G.stickers);l&&delete l[-1],!l||isEmpty(l)?(G.onStickersLoad=G.tabSwitch.pbind(e,e,n.emojiId),G.stickersLoadingProgress(n.emojiId,e,c)):(a.initedStickers=0,G.tabSwitch(c,e,n.emojiId))}}}return t&&r||G.previewSticker(e,!1,{sticker_referrer:"message"}),i&&cancelEvent(i),!1},stickersLoadingProgress:function(e,t,i){var r=G.opts[e];removeClass(geByClass1("emoji_tab_sel",r.tt),"emoji_tab_sel"),addClass(i,"emoji_tab_sel"),geByClass1("emoji_scroll_stickers",r.tt).innerHTML='<div class="emoji_scroll_progress">'+rs(vk.pr_tpl,{id:"",cls:"pr_big"})+"</div>"},buyStickers:function(e,t,i,r,n){if(i&&hasClass(i,"secondary"))return!0;if(K())return(0,h.lockButton)(i),I.Cart.create([e]).order({hash:r,ref:n}).then((t=>{if((0,h.unlockButton)(i),t&&!t.error){showDoneBox((0,R.getPurchaseResult)(t));try{vk.widget&&window.Rpc&&window.Rpc.callMethod("proxy","updateStickers")}catch(e){}"video_live"===n&&window.Videoview&&window.Videoview.onStickersPurchased(e),(0,c.partConfigEnabled)("stickers_catalog_reload_after_buy")&&(cur.boxStickersStore?cur.boxStickersStore.reload():nav.reload({params:{tab:G.getSelectedStickersStoreTabId()},preventScroll:!0}))}})),cancelEvent(t);var s=G.selectPeer();return ajax.post("/al_im.php",{act:"a_stickers_buy",pack_id:e,hash:r,peer:s,sticker_referrer:unclean(n)},{onDone:function(t,i,r,s,o,a){if(each(geByClass("_sticker_btn_"+e),(function(){this.innerHTML=s,this.onmouseover="",this.onclick="",addClass(this,"secondary")})),cur.boxStickersPreview&&cur.boxStickersPreview.hide(),o&&cur.boxStickersStore&&cur.boxStickersStore.hide(),showDoneBox(t),i){G.stickers[G.TAB_RECENT_STICKERS].promoted=a,G.updateTabs(i,r,!0);try{vk.widget&&window.Rpc&&window.Rpc.callMethod("proxy","updateStickers")}catch(e){}"video_live"===n&&window.Videoview&&window.Videoview.onStickersPurchased(e)}var l=cur.tabbedStickersBox;if(l&&l.tbUpdate)for(var d in l.tbUpdate)l.tbUpdate.hasOwnProperty(d)&&(l.tbUpdate[d]=1);var u=cur.emojiId&&cur.emojiId[cur.peer];if(u){var _=geByClass1("emoji_tab_"+e,G.opts[u].tt);_&&G.tabSwitch(_,e,u)}(0,c.partConfigEnabled)("stickers_catalog_reload_after_buy")&&nav.reload({preventScroll:!0})},showProgress:h.lockButton.pbind(i),hideProgress:h.unlockButton.pbind(i),onFail:function(e){return e&&setTimeout((0,p.showFastBox)((0,v.getLang)("global_error"),e).hide,3e3),!0}}),cancelEvent(t)},stickerAct:function(e,t,i,r,n){if(n&&hasClass(e,"secondary"))return!0;var s=(n?hasClass(e,"secondary"):hasClass(e,"_im_sticker_activated"))?1:0,o=cur.tabbedStickersBox;if(o)for(var a in o.tbUpdate)o.tbUpdate.hasOwnProperty(a)&&(o.tbUpdate[a]=1);return ajax.post("/al_im.php",{act:"a_stickers_switch",pack_id:t,hash:i,state:s,from_btn:n?1:0},{onDone:function(i,r,o,a){n||(y.FlatButton.setLabel(e,i),e.onmouseover="",setStyle(e,{width:"auto"}),toggleClass(e,"_im_sticker_activated",!s)),each(geByClass("_sticker_btn_"+t),(function(){y.FlatButton.setLabel(this,a),this.onmouseover="",toggleClass(this,"secondary",!s)})),G.updateTabs(r,o,!0);var c=e.parentNode.parentNode;if(!n){if(cur.stickersSorter.destroy(),s){show("im_stickers_deact");var l=ge("im_stickers_deact_wrap");l.firstChild?l.insertBefore(c,l.firstChild):l.appendChild(c),setStyle(c,{cursor:"default"})}else{geByTag1("div","im_stickers_my_wrap").appendChild(c),ge("im_stickers_deact_wrap").childNodes.length||hide("im_stickers_deact")}cur.stickersSorterInit()}},showProgress:()=>y.FlatButton.lock(e),hideProgress:()=>y.FlatButton.unlock(e)}),cancelEvent(r)},getTabsCode:function(e,t){var i=[];e&&i.push.apply(i,e),i.length>1&&(G.hasNewStickers=!1);for(var r=G.opts[t].forceStickerPack,n="",s="",o=0,a=i;o<a.length;o++){var c=a[o],l=c[0],d=c[1],u=c[3],_=c[4]&&l===r,f=c[5];if(d||u||_){var m=c[6],h=c[7],p=c[8],g=void 0;if(d||_?(l>0&&-1===G.stickerPacksToLoad.indexOf(l)&&G.stickerPacksToLoad.push(l),g="Emoji.tabSwitch(this, "+l+", "+t+"); return cancelEvent(event);"):g="Emoji.previewSticker("+l+", false, {sticker_referrer: 'keyboard'}); return cancelEvent(event);",c[2]&&(G.hasNewStickers=c[2]),l===G.TAB_RECENT_STICKERS){var v="emoji_tab emoji_tab_img_cont emoji_tab_recent emoji_tab_"+l;cur.stickersTab==l&&(v+=" emoji_tab_sel"),n+='<a class="'+v+'" onmousedown="'+g+'" onclick="return cancelEvent(event);"><span class="emoji_tab_icon emoji_sprite emoji_tab_icon_recent"></span></a>'}else if(l===G.TAB_FAVORITE_STICKERS)n+=G.tabs.favoriteTabContent(g,m);else if(l){var k="emoji_tab emoji_tab_img_cont emoji_tab_"+l;(h||p)&&(k+=" emoji_tab_is_new"),cur.stickersTab==l&&(k+=" emoji_tab_sel"),d||_||(k+=" emoji_tab_promo");var S='<a class="'+k+'" onmousedown="'+g+'" onclick="return cancelEvent(event);"><img width="22" height="22" src="'+f+'" class="emoji_tab_img" /></a>';_?s=S+s:s+=S}else{var w="emoji_tab emoji_tab_"+l;cur.stickersTab==l&&(w+=" emoji_tab_sel"),d||(w+=" emoji_tab_promo"),n+='<a class="'+w+'" onmousedown="'+g+'" onclick="return cancelEvent(event);"><div class="emoji_tab_icon emoji_sprite emoji_tab_icon_'+l+'"></div></a>'}}}return n+s},updateTabsOpt:function(e,t){var i=G.opts[e];if(!i.noStickers){var r=ge("emoji_tabs_cont_"+e);r&&(r.innerHTML=G.getTabsCode(window.emojiStickers,e)),G.checkEmojiSlider(i),G.checkNewStickers(i),void 0!==typeof t&&(i.stickersInited=!!t)}},updateTabs:function(e,t,i){e&&i&&window.Notifier&&Notifier.lcSend("emoji",{act:"updateTabs",newStickers:e,keywords:t});var r=0;for(var n in void 0===t?(G.initStickersKeywords(),window.stickersKeywordsData||(r=1)):(window.stickersKeywordsData=t,G.setStickersKeywords(window.stickersKeywordsData,i)),void 0===e?window.emojiStickers&&window.stickersKeywordsData||ajax.post("al_im.php",{act:"a_stickers_list",need_keywords:r,cache_time:G.cachedStickersKeywordsTime()},{onDone:G.updateTabs}):window.emojiStickers=e,G.opts)G.opts.hasOwnProperty(n)&&G.updateTabsOpt(n,!1);var s=G.stickers&&clone(G.stickers);s&&delete s[G.TAB_RECENT_STICKERS],G.onStickersLoad&&window.emojiStickers&&!isEmpty(s)&&(G.onStickersLoad(),G.onStickersLoad=!1)},showStickersStoreNotification(){Array.from(document.querySelectorAll(".emoji_smile")).filter((e=>!e.querySelector(".emoji_smile_icon_promo"))).forEach((e=>{e.appendChild(ce("div",{className:"emoji_smile_icon_promo"}))}));var e=document.querySelector("#l_stickers");e&&e.classList.add("AppLeftMenuWithNotify")},hideStickersStoreNotification(){document.querySelectorAll(".emoji_smile_icon_promo").forEach((e=>{e.parentNode.removeChild(e)}));var e=document.querySelector("#l_stickers");e&&e.classList.remove("AppLeftMenuWithNotify")},checkNewStickers:function(e){var t=e.txt;if(!e.noStickers&&!e.noStickersStore&&window.emojiStickers&&t&&t.getAttribute("contenteditable")){for(var i in window.emojiStickers)if(window.emojiStickers.hasOwnProperty(i)&&window.emojiStickers[i][2]){G.hasNewStickers=window.emojiStickers[i][2];break}G.hasNewStickers<0&&!G.noNewStickers&&setTimeout((()=>G.showStickersStoreNotification()),hasClass(t,"fc_editable")?200:0)}},checkEmojiSlider:function(e){var t=geByClass1("emoji_tabs_wrap",e.tt),i=!1;if(t){if(t.firstChild.clientWidth&&t.firstChild.clientWidth>t.clientWidth+t.scrollLeft)i=!0;else{var r=t.firstChild.childNodes;r.length>6&&(e.scrollLeft||0)<34*(r.length-6)-16&&(i=!0)}var n=vk.rtl?"l":"r";i?(e.sliderShown=!0,G.scrollToggleArrow(!0,n,e,!0)):e.sliderShown&&(e.sliderShown=!1,G.scrollToggleArrow(!1,n,e,!0))}},giftStickerToCurrentPeer(e,t,i,r){var n=this.getPeerId(e);(0,w.isUserPeer)(n)||(0,w.isChatPeer)(n)?this.giftSticker(t,n,i,r):this.giftSticker(t,"",i,r)},giftSticker:function(e,t,i,r){if(K())return(0,j.giftStickerProducts)([e],t?String(t).split(",").map((e=>Number(e))):[],{ref:r.sticker_referrer||"store",gift_ref:r.ref}),cancelEvent(i);var n={act:"stickers_gift_box",pack_id:e,peers:t,ref:(r=r||{}).ref};return r.from&&(n.from=r.from),n.sticker_referrer=r.sticker_referrer||"store",boxLayerWrap.scrollTop=0,showBox("/al_im.php",n,{stat:["wide_dd.js","wide_dd.css","notifier.css","notifier.js"],dark:1}),cancelEvent(i)},showStickerTT:function(e){var t=e.getAttribute("data-title");t&&(0,g.showTooltip)(e,{text:t,slide:15,shift:[74-getSize(e)[0]/2,120,5],className:"sticker_hint_tt",hasover:1})},scrollToStickerPack:function(e,t,i){var r=G.opts[e],n=ge("emoji_tab_cont_"+t+"_"+e),s=n&&t!=G.tabDefaultId?n.offsetTop+getSize(n)[1]:0;r.scrollAnimation=1,r.emojiScroll.scrollTop(s,i?0:200,(function(){r.scrollAnimation=0})),G.scrollToTab(t,e)},toggleStickers:function(e,t){var i=G.opts[e];i&&i.tt?(i.noStickers=t,toggleClass(i.tt,"emoji_no_tabs",t),i.curTab&&G.tabSwitch(0,0,e)):i&&(i.hideStickersInitial=t)},getSizeCached:function(e){return(e=ge(e))?(void 0!==e[G.CACHED_WIDTH_PROP]&&void 0!==e[G.CACHED_HEIGHT_PROP]||(e[G.CACHED_WIDTH_PROP]=e.offsetWidth,e[G.CACHED_HEIGHT_PROP]=e.offsetHeight),[e[G.CACHED_WIDTH_PROP],e[G.CACHED_HEIGHT_PROP]]):[0,0]},clearSizeCached:function(e){(e=ge(e))&&(e[G.CACHED_WIDTH_PROP]=void 0,e[G.CACHED_HEIGHT_PROP]=void 0)},getStickerReferrer:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=G.opts[t];return i&&"stories"===i.ref?G.STICKER_REFERRERS.STORY_KEYBOARD:e===G.TAB_RECENT_STICKERS?G.STICKER_REFERRERS.RECENT:e===G.TAB_FAVORITE_STICKERS?G.STICKER_REFERRERS.FAVORITE:e===G.TAB_NEW_CONVO_STICKERS?G.STICKER_REFERRERS.NEW_CONVO:G.STICKER_REFERRERS.KEYBOARD},render:{sticker:function(e,t,i){var r=G.render.stickerRs(e,t,i);return se(r)},stickerRs:function(e,t,i){var r={optId:e,selId:t,stickerId:i[0],size:i[1]?i[1]:256,stickerUrl:i[2],fav:i[4]||"",favHash:i[5]||"",referrer:G.getStickerReferrer(t,e),favClass:i[4]?"faved":""},n="";if(browser.msie&&!browser.msie_edge||!i[3])n=G.stickerItem();else{n=G.stickerItemAnimation();var s=rand(1,1e5);r.animationUrl=i[3],r.uniqId=s}return rs(n,r)},stickerHintRs:function(e,t,i){var r=t,n="";if(t<0)n=window.promotedStickerUrls&&window.promotedStickerUrls[-r];else if(i)n=i[2];else{var s=(0,P.getSticker)(r);s&&(n=(0,C.getStickerImageUrl)(s,64,64))}var o=i?i[3]:"",a={optId:e,selId:0,stickerId:r,stickerUrl:n,class:r<0?"promo":"",onclick:"Emoji.stickerHintClick("+e+", "+r+", '"+n+"', this)"},c="";return(!browser.msie||browser.msie_edge)&&o&&n?(c=G.hintsStickerItemAnimation(),a.animationUrl=o,a.class+=" sticker_animation"):n&&(c=G.hintsStickerItem()),rs(c,a)},stickerContent:function(e,t,i){var r=attr(t,"data-animation-path"),n=attr(t,"data-src"),s="/images/blank.gif";i||(s=n);var o=attr(t,"data-sticker-id"),a=attr(t,"data-fav-hash"),c=attr(t,"data-fav"),l="";r?l='<div data-uniq-id="'+attr(t,"data-uniq-id")+'" onmouseenter="StickersAnimation.loadAndPlaySticker(this);" class="sticker_animation" data-sticker-id="'+o+'" data-animation-path="'+r+'"><img class="sticker_img emoji_sticker_image" src="'+s+'" data-src="'+n+'"/></div>':l='<img class="emoji_sticker_image" src="'+s+'" data-src="'+n+'"/>';if(G.favoriteAvailable){var d="";1==c&&(d="on"),l+=`<span role="link"\n               onmouseover="Emoji.favorite.reminder(this)"\n               class="emoji_sticker_item_fav ${d}"\n               data-sticker-id="${o}"\n               data-hash="${a}"\n               onmousedown="Stickers.toggleFavorite(this, event, ${e}); cancelEvent(event);"\n               onclick="cancelEvent(event)"></span>`}return val(t,l),n}},__eof:1}},494422:(e,t,i)=>{"use strict";i.d(t,{getCaretBoundingRect:()=>r});var r=function(e){var t=e.getBoundingClientRect(),i=null,r=null;if(t.top===t.bottom)return{left:0,top:0,bottom:0};if(document.selection)(i=(r=document.selection.createRange()).getClientRects()||[]).length||(r.text="_",r.moveStart("character",-1),i=r.getClientRects(),r.text=""),i=i[i.length-1];else if(window.getSelection){var n=getSelection();if(n.anchorNode){if((r=n.getRangeAt(0)).collapsed){var s=r.startOffset;r.setStart(r.startContainer,0),i=r.getClientRects(),r.setStart(r.startContainer,s)}i=i&&i.length?i[i.length-1]:{right:t.left,top:t.top,bottom:t.top}}else i={right:0,top:0,bottom:0}}return{left:i.right-t.left,top:i.top-t.top,bottom:i.bottom-t.top}}},408270:(e,t,i)=>{"use strict";i.d(t,{EMOJI_SECTIONS_CODES:()=>s});i(991181),i(296253);var r=i(754259),n={1:["😀","😃","😄","😁","😅","😆","😂","🤣","😉","😊","☺","🙂","🙃","😇","😗","😙","😚","😘","😍","🥰","🤩","🤗","😋","😜","🤪","😛","😝","🤑","🤭","🤐","🤫","😶","🤔","🤨","🧐","😐","😑","🙄","😬","🤥","😏","😌","🤤","😴","🤓","😎","🥳","🤠","😒","😔","😪","😕","😟","🙁","☹","😮","😯","😲","😳","🥺","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","😷","🤒","🤕","🤢","🤮","🤧","🥶","🥵","🥴","😵","🤯","😤","😠","😡","🤬","😈","👿","💀","☠","💩","🤡","👹","👺","👻","👽","👾","🤖","😺","😸","😹","😻","😼","😽","🙀","😿","😾","🙈","🙉","🙊","🦠"],2:["🐵","🐒","🦍","🐶","🐕","🐩","🐺","🦊","🦝","🐱","🐈","🦁","🐯","🐅","🐆","🐴","🐎","🦄","🦓","🦌","🐮","🐂","🐃","🐄","🐷","🐽","🐖","🐗","🐏","🐑","🐐","🐪","🐫","🦙","🦒","🐘","🦏","🦛","🐭","🐁","🐀","🐹","🐰","🐇","🐿","🦔","🦇","🐻","🐨","🐼","🦘","🦡","🐾","🦃","🐔","🐓","🐣","🐤","🐥","🐦","🐧","🕊","🦅","🦆","🦢","🦉","🦚","🦜","🐸","🐊","🐢","🦎","🐍","🐲","🐉","🦕","🦖","🐳","🐋","🐬","🐟","🐠","🐡","🦈","🐙","🦀","🦞","🦐","🦑","🐚","🐌","🦋","🐛","🐜","🐝","🐞","🦗","🕷","🕸","🦂","🦟","💐","🌸","💮","🏵","🌹","🥀","🌺","🌻","🌼","🌷","🌳","🌲","🎄","🌴","🌵","🌾","🌱","🌿","☘","🍀","🍁","🍂","🍃","🌑","🌒","🌓","🌔","🌕","🌖","🌗","🌘","🌙","🌚","🌛","🌜","🌡","☀","🌝","🌞","⭐","🌟","🌠","☁","⛅","⛈","🌤","🌥","🌦","🌧","🌨","🌩","🌪","🌫","🌬","💨","🌀","🌈","🌂","☂","☔","⛱","⚡","❄","☃","⛄","☄","🔥","💦","💧","🌊"],3:["👍🏻","👎🏻","👌🏻","✌🏻","🤞🏻","🤟🏻","🤘🏻","🤙🏻","🖕🏻","✊🏻","👊🏻","🤛🏻","🤜🏻","👈🏻","👉🏻","👆🏻","👇🏻","☝🏻","👋🏻","🤚🏻","🖐🏻","✋🏻","🖖🏻","👏🏻","🙌🏻","👐🏻","🤲🏻","🤝🏻","🙏🏻","💪🏻","🦵🏻","🦶🏻","👂🏻","👃🏻","🧠","🦷","🦴","👀","👁","👅","👄","✍🏻","💅🏻","🤳","👫","👭","👬","👩‍❤️‍💋‍👨","👨‍❤️‍💋‍👨","👩‍❤️‍💋‍👩","👩‍❤️‍👨","👨‍❤️‍👨","👩‍❤️‍👩","👪","👶","🧒","👦","👧","🧑","👱","👨","🧔","👱‍♂️","👨‍🦰","👨‍🦱","👨‍🦳","👨‍🦲","👩","👱‍♀️","👩‍🦰","👩‍🦱","👩‍🦳","👩‍🦲","🧓️","👴️","👵️","🙍‍♂️️","🙍‍♀️️","🙎‍♂️","🙎‍♀️️","🙅‍♂️","🙅‍♀️","🙆‍♂️","🙆‍♀️","💁‍♂️","💁‍♀️️","🙋‍♂️","🙋‍♀️️","🙇‍♂️","🙇‍♀️️","🤦‍♂️","🤦‍♀️","🤷‍♂️","🤷‍♀️","💆‍♂️️","💆‍♀️","💇‍♂️️","💇‍♀️","🚶‍♂️️","🚶‍♀️️","🏃‍♂️️","🏃‍♀️","💃","🕺","🕴️","👯‍♂️️","👯‍♀️","🧖‍♂️","🧖‍♀️️","👼","🎅","🤶","🦸‍♂️","🦸‍♀️","🦹‍♂️","🦹‍♀️","🧙‍♂️","🧙‍♀️","🧚‍♂️","🧚‍♀️","🧛‍♂️","🧛‍♀️","🧜‍♂️","🧜‍♀️","🧝‍♂️","🧝‍♀️","🧞‍♂️","🧞‍♀️","🧟‍♂️","🧟‍♀️","👨‍⚕️","👩‍⚕️","👨‍🎓","👩‍🎓","👨‍🏫","👩‍🏫","👨‍⚖️","👩‍⚖️","👨‍🌾","👩‍🌾","👨‍🍳","👩‍🍳","👨‍🔧","👩‍🔧","👨‍🏭","👩‍🏭","👨‍💼","👩‍💼","👨‍🔬","👩‍🔬","👨‍💻","👩‍💻","👨‍🎤","👩‍🎤","👨‍🎨","👩‍🎨","👨‍✈️","👩‍✈️","👨‍🚀","👩‍🚀","👨‍🚒","👩‍🚒","👮‍♂️","👮‍♀️","🕵️‍♂️","🕵️‍♀️","💂‍♂️","💂‍♀️","👷‍♂️","👷‍♀️","🤴","👸","👳‍♂️","👳‍♀️","👲","🧕","🤵","👰","🤰","🤱","🛀","🛌"],4:["🍏","🍎","🍐","🍅","🥝","🍑","🍒","🍓","🍇","🍈","🍉","🍊","🍋","🍌","🍍","🥭","🥥","🥑","🍆","🥔","🥕","🌽","🌶","🥒","🥬","🥦","🍄","🥜","🌰","🍞","🥐","🥖","🥨","🥯","🥞","🧀","🍖","🍗","🥩","🥓","🍔","🍟","🍕","🌭","🥪","🌮","🌯","🥙","🥚","🍳","🥘","🍲","🥣","🥗","🍿","🧂","🥫","🍱","🍘","🍙","🍚","🍛","🍜","🍝","🍠","🍢","🍣","🍤","🍥","🥮","🍡","🥟","🥠","🥡","🍦","🍧","🍨","🍩","🍪","🎂","🍰","🧁","🥧","🍫","🍬","🍭","🍮","🍯","🍼","🥛","☕","🍵","🍶","🍾","🍷","🍸","🍹","🍺","🍻","🥂","🥃","🥤","🥢","🍽","🍴","🥄"],5:["⚽","⚾","🥎","🏀","🏐","🏈","🏉","🎾","🥏","🎳","🏏","🏑","🏒","🥍","🏓","🏸","🥊","🥋","🥅","⛳","⛸","🎣","🎽","🛹","🎿","🛷","🥌","🎯","🎱","🎮","🕹","🎰","🎲","🧩","♟","🧗‍♂️️","🧗‍♀️","🤺","🏇","⛷","🏂","🏌️‍♂️","🏌️‍♀️","🏄‍♂️","🏄‍♀️","🚣‍♂️","🚣‍♀️","🏊‍♂️","🏊‍♀️","⛹️‍♂️","⛹️‍♀️","🏋️‍♂️","🏋️‍♀️","🚴‍♂️","🚴‍♀️","🚵‍♂️","🚵‍♀️","🤸","🤼‍♂️","🤼‍♀️","🤽‍♂️","🤽‍♀️","🤾‍♂️","🤾‍♀️","🤹‍♂️","🤹‍♀️","🧘‍♂️","🧘‍♀️","🎖","🏆","🏅","🥇","🥈","🥉"],6:["🚂","🚃","🚄","🚅","🚆","🚇","🚈","🚉","🚊","🚝","🚞","🚋","🚌","🚍","🚎","🚐","🚑","🚒","🚓","🚔","🚕","🚖","🚗","🚘","🚙","🚚","🚛","🚜","🏎","🏍","🛵","🚲","🛴","🚏","🛣","🛤","🛢","⛽","🚨","🚥","🚦","🛑","🚧","⚓","⛵","🛶","🚤","🛳","⛴","🛥","🚢","✈","🛩","🛫","🛬","💺","🚁","🚟","🚠","🚡","🛰","🚀","🛸","🌍","🌎","🌏","🌐","🗺","🗾","🧭","🏔","⛰","🌋","🗻","🏕","🏖","🏜","🏝","🏞","🏟","🏛","🏗","🧱","🏘","🏚","🏠","🏡","🏢","🏣","🏤","🏥","🏦","🏨","🏩","🏪","🏫","🏬","🏭","🏯","🏰","💒","🗼","🗽","⛪","🕌","🕍","⛩","🕋","⛲","⛺","🌁","🌃","🏙","🌄","🌅","🌆","🌇","🌉","♨","🌌","🎠","🎡","🎢","💈","🎪"],7:["🎙","🎚","🎛","🎤","🎧","📻","🎷","🎸","🎹","🎺","🎻","🥁","📯","🎭","🖼","🎨","🧵","🧶","🔮","🧿","🧸","🃏","🀄","🎴","🎃","🎆","🎇","🧨","✨","🎈","🎉","🎊","🎋","🎍","🎎","🎏","🎐","🎑","🧧","🎀","🎁","🎗","🎟","🎫","🛎","🧳","⌛","⏳","⌚","⏰","⏱","⏲","🕰","👓","🕶","🥽","🥼","👔","👕","👖","🧣","🧤","🧥","🧦","👗","👘","👙","👚","👛","👜","👝","🛍","🎒","👞","👟","🥾","🥿","👠","👡","👢","👑","👒","🎩","🎓","🧢","⛑","📿","💄","💍","💎","📱","📲","☎","📞","📟","📠","🔋","🔌","💻","🖥","🖨","⌨","🖱","🖲","💽","💾","💿","📀","🧮","🎥","🎞","📽","🎬","📺","📷","📸","📹","📼","🔍","🔎","🕯","💡","🔦","🏮","📔","📕","📖","📗","📘","📙","📚","📓","📒","📃","📜","📄","📰","🗞","📑","🔖","🏷","💰","💴","💵","💶","💷","💸","💳","🧾","💹","💱","💲","✉","💌","📧","📨","📩","📤","📥","📦","📫","📪","📬","📭","📮","🗳","✏","✒","🖋","🖊","🖌","🖍","📝","💼","📁","📂","🗂","📅","📆","🗒","🗓","📇","📈","📉","📊","📋","📌","📍","📎","🖇","📏","📐","✂","🗃","🗄","🗑","🔒","🔓","🔏","🔐","🔑","🗝","🔨","⛏","⚒","🛠","🗡","⚔","🔪","🔫","🏹","🛡","🔧","🔩","⚙","🗜","⚖","🔗","⛓","🧰","🧲","⚗","🧪","🧫","🧬","🔬","🔭","📡","💉","💊","🚪","🛏","🛋","🚽","🚿","🛁","🧴","🧷","🧹","🧺","🧻","🧼","🧽","🧯","🛒","🚬","⚰","⚱","🏺","🗿"],8:["💋","❤","💔","❣","💘","💝","💖","💗","💓","💞","💕","💟","💜","🧡","💛","💚","💙","🖤","💯","💢","💥","💫","🕳","💣","💬","👁️‍🗨️","🗨","🗯","💭","💤","🗣","👤","👥","👣","🔇","🔊","📢","📣","🔔","🔕","🎼","🎵","🎶","⚠","🚸","☢","☣","🆚","🆓","🆕","🚮","🚾","🚭","✅","♻","⚕","🔱","‼","⁉","❓","❗","🆘","⛔","🚫","🚳","🚯","🚱","🚷","📵","🔞"],9:["🇷🇺","🇰🇿","🇧🇾","🇺🇦","🇲🇳","🇬🇪","🇦🇿","🇹🇯","🇧🇷","🇱🇹","🇱🇻","🇪🇪","🇦🇲","🏁","🚩","🎌","🏴","🏳","🏳️‍🌈","🏴‍☠️","🇦🇨","🇦🇩","🇦🇪","🇦🇫","🇦🇬","🇦🇮","🇦🇱","🇦🇴","🇦🇶","🇦🇷","🇦🇸","🇦🇹","🇦🇺","🇦🇼","🇦🇽","🇧🇦","🇧🇧","🇧🇩","🇧🇪","🇧🇫","🇧🇬","🇧🇭","🇧🇮","🇧🇯","🇧🇱","🇧🇲","🇧🇳","🇧🇴","🇧🇶","🇧🇸","🇧🇹","🇧🇻","🇧🇼","🇧🇿","🇨🇦","🇨🇨","🇨🇩","🇨🇫","🇨🇬","🇨🇭","🇨🇮","🇨🇰","🇨🇱","🇨🇲","🇨🇳","🇨🇴","🇨🇵","🇨🇷","🇨🇺","🇨🇻","🇨🇼","🇨🇽","🇨🇾","🇨🇿","🇩🇪","🇩🇬","🇩🇯","🇩🇰","🇩🇲","🇩🇴","🇩🇿","🇪🇨","🇪🇬","🇪🇭","🇪🇷","🇪🇸","🇪🇹","🇪🇺","🇫🇮","🇫🇯","🇫🇰","🇫🇲","🇫🇴","🇫🇷","🇬🇦","🇬🇧","🇬🇩","🇬🇫","🇬🇬","🇬🇭","🇬🇮","🇬🇱","🇬🇲","🇬🇳","🇬🇵","🇬🇶","🇬🇷","🇬🇸","🇬🇹","🇬🇺","🇬🇼","🇬🇾","🇭🇰","🇭🇲","🇭🇳","🇭🇷","🇭🇹","🇭🇺","🇮🇨","🇮🇩","🇮🇪","🇮🇱","🇮🇲","🇮🇳","🇮🇴","🇮🇶","🇮🇷","🇮🇸","🇮🇹","🇯🇪","🇯🇲","🇯🇴","🇯🇵","🇰🇪","🇰🇬","🇰🇭","🇰🇮","🇰🇲","🇰🇳","🇰🇵","🇰🇷","🇰🇼","🇰🇾","🇱🇦","🇱🇧","🇱🇨","🇱🇮","🇱🇰","🇱🇷","🇱🇸","🇱🇺","🇱🇾","🇲🇦","🇲🇨","🇲🇩","🇲🇪","🇲🇫","🇲🇬","🇲🇭","🇲🇰","🇲🇱","🇲🇲","🇲🇴","🇲🇵","🇲🇶","🇲🇷","🇲🇸","🇲🇹","🇲🇺","🇲🇻","🇲🇼","🇲🇽","🇲🇾","🇲🇿","🇳🇦","🇳🇨","🇳🇪","🇳🇫","🇳🇬","🇳🇮","🇳🇱","🇳🇴","🇳🇵","🇳🇷","🇳🇺","🇳🇿","🇴🇲","🇵🇦","🇵🇪","🇵🇫","🇵🇬","🇵🇭","🇵🇰","🇵🇱","🇵🇲","🇵🇳","🇵🇷","🇵🇸","🇵🇹","🇵🇼","🇵🇾","🇶🇦","🇷🇪","🇷🇴","🇷🇸","🇷🇼","🇸🇦","🇸🇧","🇸🇨","🇸🇩","🇸🇪","🇸🇬","🇸🇭","🇸🇮","🇸🇯","🇸🇰","🇸🇱","🇸🇲","🇸🇳","🇸🇴","🇸🇷","🇸🇸","🇸🇹","🇸🇻","🇸🇽","🇸🇾","🇸🇿","🇹🇦","🇹🇨","🇹🇩","🇹🇫","🇹🇬","🇹🇭","🇹🇰","🇹🇱","🇹🇲","🇹🇳","🇹🇴","🇹🇷","🇹🇹","🇹🇻","🇹🇼","🇹🇿","🇺🇬","🇺🇲","🇺🇳","🇺🇸","🇺🇾","🇺🇿","🇻🇦","🇻🇨","🇻🇪","🇻🇬","🇻🇮","🇻🇳","🇻🇺","🇼🇫","🇼🇸","🇽🇰","🇾🇪","🇾🇹","🇿🇦","🇿🇲","🇿🇼"]},s=Object.keys(n).reduce(((e,t)=>(e[t]=n[t].map((e=>(0,r.emojiSymbolToByteHex)(e))),e)),{})},857748:(e,t,i)=>{"use strict";i.d(t,{parseAttachmentId:()=>r,prepareImageBounds:()=>n,getPhotoSize:()=>s});i(991181),i(296253),i(796409),i(820075),i(21466);function r(e){if(!e||"string"!=typeof e)return null;var t=e.match(/(photo|doc)(-?\d+)_(\d+)/);if(!t)return null;var i=t[1],r=parseInt(t[2]),n=parseInt(t[3]),s=[r,n].join("_");return{type:i,ownerId:r,id:n,rawId:s}}function n(e,t){var i=e;return e>68&&(i=68),t>68&&(i=68*e/t),[i,i*(t/e)]}function s(e,t,i){if(!e||!t||!i)return null;var r=Object.values(e).sort(((e,t)=>e[1]-t[1]||e[2]-t[2]));return r.find((e=>e[1]>=t&&e[2]>=i))||r[parseInt(r.length/2)]||r[0]}},11122:(e,t,i)=>{"use strict";i.d(t,{default:()=>p});i(175115),i(530522),i(66108),i(579665),i(95767),i(991181),i(296253),i(83276),i(59357),i(21466),i(283946);var r=i(962857);function n(){return n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},n.apply(this,arguments)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!t||i.length!==t);r=!0);}catch(e){n=!0,s=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw s}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return o(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}var a=["мне","тебе","ему","ей","маме","папе","сестре","брату","родителям"],c=["ден(?:ьги|ежки|ьгу|ежку|ег|ежек|як)","дол(?:г|жок)","(?:(?:в|на)\\s)подар(?:ок|ки)"],l=["переводом","(?:(?:по|на)\\s)(?:номеру?\\s)?(?:карт(?:у|очку|ы|очки)|тел(?:ефона)?)","(?:по\\s)?безнал(?:у|ичке|ом|ичкой)","на\\sсбер(?:банк)?"],d=["сот(?:оч)ку","\\d+(?:\\s*р(?:[.,\\s]|уб(?:лей)?|$))?"],u=new RegExp(`(${d.join(")|(")})`);function _(e,t){return"amount"===e?function(e){var t=e.match(u);if(t){if(t[1])return 100;if(t[2])return parseInt(t[2])}return 0}(t):t}var f=new RegExp(`^(?:(${["(?:за|с|пере)?кин(?:ь(?:ся)?|ьте(?:сь)?|ешь(?:ся)?|ете(?:сь)?)","переве(?:ди|дите|дешь|дете)","отправ(?:ь|ьте|ишь|ите)","соб(?:ери|ерите|ерешь|ерете)","(?:от)?да(?:й|йте|шь|дите)","верн(?:и|ите|ешь|ете)","возвра(?:ти|тите|тишь|щай|щайте)","займ(?:и|ите|ешь)"].join("|")})|(${["перевод","(?:за|с|пере)?кин(?:уть(?:ся)?|у(?:сь)?|ем(?:ся)?)","переве(?:сти|вожу|дим|ду|ем)","отправ(?:ить|ляю|ляем|лю|им)","(?:со)?б(?:рать|ираю|ираем|еру|ерем)","(?:от)?да(?:ть|ю|ем|м|дим)","верн(?:уть|у|ем)","возвра(?:тить|щу|тим|щаю|щаем)"].join("|")}))((?:\\s+(?:${[...a,...c,...l,...d].join("|")}))+)\\s*$`),m=new RegExp(`(${a.join("|")})|(${c.join("|")})|(${l.join("|")})|(${d.join("|")})`,"gi"),h={DEFAULT_QUERY:"деньги",introViewed:!1,match:function(e){var t=e.toLowerCase().replace(/ё/g,"е").match(f);if(t){for(var i={input:e,request:t[1],send:t[2],context:t[3]};t=m.exec(i.context),t;)for(var r={receiver:t[1],subject:t[2],method:t[3],amount:t[4]},n=0,o=Object.entries(r);n<o.length;n++){var a=s(o[n],2),c=a[0],l=a[1];l&&(i[c]=_(c,l))}if(i.subject||i.method||i.amount)return i}return null},setIntroViewed:function(e){this.introViewed=e},onClick:function(e,t,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(this.introViewed){var a=[e,t,i,s].join("_");r.MoneyTransfer.showMoneyTransferBox({tab:i,amount:s,owner_id:e,to_id:t,from:"sticker_link"},{cache:this.lastBoxId===a},void 0,(()=>{cur.paymentsOptions&&(cur.paymentsOptions.onSendStart=o.onSendStart)})),this.lastBoxId=a}else showWiki(n({w:"moneysend_promo",fromId:e,toId:t,action:i},s?{amount:s}:{})),this.introViewed=!0}};const p=h},748759:(e,t,i)=>{"use strict";i.d(t,{useInView:()=>g});var r=i(667294),n=i(702177);function s(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},o.apply(this,arguments)}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var c=new Map,l=new Map,d=new Map,u=0;function _(e,t,i){void 0===i&&(i={}),i.threshold||(i.threshold=0);var r=i,s=r.root,o=r.rootMargin,a=r.threshold;if(c.has(e)&&(0,n.default)(!1),e){var _=function(e){return e?d.has(e)?d.get(e):(u+=1,d.set(e,u.toString()),d.get(e)+"_"):""}(s)+(o?a.toString()+"_"+o:a.toString()),f=l.get(_);f||(f=new IntersectionObserver(m,i),_&&l.set(_,f));var h={callback:t,element:e,inView:!1,observerId:_,observer:f,thresholds:f.thresholds||(Array.isArray(a)?a:[a])};return c.set(e,h),f.observe(e),h}}function f(e){if(e){var t=c.get(e);if(t){var i=t.observerId,r=t.observer,n=r.root;r.unobserve(e);var s=!1,o=!1;i&&c.forEach((function(t,r){r!==e&&(t.observerId===i&&(s=!0,o=!0),t.observer.root===n&&(o=!0))})),!o&&n&&d.delete(n),r&&!s&&r.disconnect(),c.delete(e)}}}function m(e){e.forEach((function(e){var t=e.isIntersecting,i=e.intersectionRatio,r=e.target,n=c.get(r);if(n&&i>=0){var s=n.thresholds.some((function(e){return n.inView?i>e:i>=e}));void 0!==t&&(s=s&&t),n.inView=s,n.callback(s,e)}}))}var h=function(e){var t,i;function c(){for(var t,i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return s(a(t=e.call.apply(e,[this].concat(r))||this),"state",{inView:!1,entry:void 0}),s(a(t),"node",null),s(a(t),"handleNode",(function(e){t.node&&(f(t.node),e||t.props.triggerOnce||t.setState({inView:!1,entry:void 0})),t.node=e||null,t.observeNode()})),s(a(t),"handleChange",(function(e,i){(e!==t.state.inView||e)&&t.setState({inView:e,entry:i}),t.props.onChange&&t.props.onChange(e,i)})),t}i=e,(t=c).prototype=Object.create(i.prototype),t.prototype.constructor=t,t.__proto__=i;var l=c.prototype;return l.componentDidMount=function(){this.node||(0,n.default)(!1)},l.componentDidUpdate=function(e,t){e.rootMargin===this.props.rootMargin&&e.root===this.props.root&&e.threshold===this.props.threshold||(f(this.node),this.observeNode()),t.inView!==this.state.inView&&this.state.inView&&this.props.triggerOnce&&(f(this.node),this.node=null)},l.componentWillUnmount=function(){this.node&&(f(this.node),this.node=null)},l.observeNode=function(){if(this.node){var e=this.props,t=e.threshold,i=e.root,r=e.rootMargin;_(this.node,this.handleChange,{threshold:t,root:i,rootMargin:r})}},l.render=function(){var e=this.state,t=e.inView,i=e.entry;if(!function(e){return"function"!=typeof e.children}(this.props))return this.props.children({inView:t,entry:i,ref:this.handleNode});var n=this.props,s=n.children,a=n.as,c=n.tag,l=(n.triggerOnce,n.threshold,n.root,n.rootMargin,n.onChange,function(e,t){if(null==e)return{};var i,r,n={},s=Object.keys(e);for(r=0;r<s.length;r++)i=s[r],t.indexOf(i)>=0||(n[i]=e[i]);return n}(n,["children","as","tag","triggerOnce","threshold","root","rootMargin","onChange"]));return(0,r.createElement)(a||c||"div",o({ref:this.handleNode},l),s)},c}(r.Component);s(h,"displayName","InView"),s(h,"defaultProps",{threshold:0,triggerOnce:!1});var p={inView:!1,entry:void 0};function g(e){void 0===e&&(e={});var t=(0,r.useRef)(),i=(0,r.useState)(p),n=i[0],s=i[1],o=(0,r.useCallback)((function(i){t.current&&f(t.current),i&&_(i,(function(t,r){s({inView:t,entry:r}),t&&e.triggerOnce&&f(i)}),e),t.current=i}),[e.threshold,e.root,e.rootMargin,e.triggerOnce]);return(0,r.useEffect)((function(){t.current||n===p||e.triggerOnce||s(p)})),[o,n.inView,n.entry]}},702177:(e,t,i)=>{"use strict";i.d(t,{default:()=>n});var r="Invariant failed";const n=function(e,t){if(!e)throw new Error(r)}},654921:(e,t,i)=>{"use strict";i.d(t,{STICKER_PACK_ICON:()=>a,STICKER_PACK_THUMB:()=>c,STICKER_IMAGE:()=>l,STICKER_ANIMATION:()=>d,DEFAULT_CACHE:()=>u,SAMPLE_RECIPIENT_ID:()=>_,ORDER_ERRORS:()=>n,ORDER_ITEM_ERRORS:()=>s});var r,n,s,o=i(749091),a={square_png:{id:"square.png",width:104,height:104},square_15x_png:{id:"square_1.5x.png",width:156,height:156},square_2x_png:{id:"square_2x.png",width:208,height:208},square_3x_png:{id:"square_3x.png",width:312,height:312},square_4x_png:{id:"square_4x.png",width:416,height:416}},c={"102_png":{id:"102.png",width:102,height:102,theme:o.Theme.LIGHT},"51_png":{id:"51.png",width:51,height:51,theme:o.Theme.LIGHT},"68_png":{id:"68.png",width:68,height:68,theme:o.Theme.LIGHT},"34_png":{id:"34.png",width:34,height:34,theme:o.Theme.LIGHT},"60_png":{id:"60.png",width:60,height:60,theme:o.Theme.LIGHT},"30_png":{id:"30.png",width:30,height:30,theme:o.Theme.LIGHT},"102b_png":{id:"102b.png",width:102,height:102,theme:o.Theme.DARK},"51b_png":{id:"51b.png",width:51,height:51,theme:o.Theme.DARK},"68b_png":{id:"68b.png",width:68,height:68,theme:o.Theme.DARK},"34b_png":{id:"34b.png",width:34,height:34,theme:o.Theme.DARK},"60b_png":{id:"60b.png",width:60,height:60,theme:o.Theme.DARK},"30b_png":{id:"30b.png",width:30,height:30,theme:o.Theme.DARK},"44_png":{id:"44.png",width:44,height:44},"22_png":{id:"22.png",width:22,height:22}},l={"64_png":{id:"64.png",width:64,height:64,theme:o.Theme.LIGHT},"128_png":{id:"128.png",width:128,height:128,theme:o.Theme.LIGHT},"256_png":{id:"256.png",width:256,height:256,theme:o.Theme.LIGHT},"352_png":{id:"352.png",width:352,height:352,theme:o.Theme.LIGHT},"512_png":{id:"512.png",width:512,height:512,theme:o.Theme.LIGHT},"64b_png":{id:"64b.png",width:64,height:64,theme:o.Theme.DARK},"128b_png":{id:"128b.png",width:128,height:128,theme:o.Theme.DARK},"256b_png":{id:"256b.png",width:256,height:256,theme:o.Theme.DARK},"352b_png":{id:"352b.png",width:352,height:352,theme:o.Theme.DARK},"512b_png":{id:"512b.png",width:512,height:512,theme:o.Theme.DARK}},d=((r={})[o.Theme.LIGHT]="animation.json",r[o.Theme.DARK]="animation.b.json",r),u={products:(0,o.createProductsMap)([]),productIdsQueue:new Set,productsPromise:void 0,productPromises:new Map,stickers:new Map},_=-1;!function(e){e.NOT_SIGNED_IN="not_signed_in",e.NO_VALID_ITEMS="no_valid_items"}(n||(n={})),function(e){e.DUPLICATE_PRODUCT="duplicate_product"}(s||(s={}))},749091:(e,t,i)=>{"use strict";var r;i.d(t,{Theme:()=>r,imageSizesIndex:()=>s,imageSizeCache:()=>o,createProductsMap:()=>a,UserProductStateKey:()=>n,isBasePack:()=>l,isStyleProduct:()=>d,isPackProduct:()=>u,ProductsByType:()=>_}),function(e){e.LIGHT="light",e.DARK="dark",e.DEFAULT="light"}(r||(r={}));var n,s=Symbol(),o=Symbol(),a=function(e){return new Map(e)};!function(e){e.IsNew="is_new"}(n||(n={}));var c,l=function(e){return void 0!==e.sticker_ids},d=function(e){return void 0!==e.base_id},u=function(e){return l(e)&&!d(e)};!function(e){e.Pack="pack",e.Style="style"}(c||(c={}));var _=function(){function e(e){var t=this;void 0===e&&(e=[]),this.pack=new Set,this.style=new Set,e.forEach((function(e){return t.add(e)}))}return e.prototype.add=function(e){e&&(u(e)?this.pack.add(e):d(e)&&this.style.add(e))},e.prototype.getPack=function(){return this.pack.values().next().value},e.prototype.getStyles=function(){return Array.from(this.style.values())},e.prototype.getCount=function(){return this.pack.size+this.style.size},e}();!function(){function e(e){var t=this;this.pack=[],this.style=[],e.forEach((function(e){return t.add(e)}))}e.prototype.add=function(e){var t=e.product;t&&(u(t)?this.pack.push(e):d(t)&&this.style.push(e))}}()},922377:(e,t,i)=>{"use strict";i.d(t,{getStickerImageUrl:()=>o,getStickerAnimationUrl:()=>a,getStickerPackIconUrl:()=>c,isSampleOrderItem:()=>l});var r=i(749091),n=i(654921),s=function(e,t,i,n){void 0===n&&(n=r.Theme.DEFAULT);var s=window.devicePixelRatio,o=[t*=s,i*=s,n].toString(),a=e[r.imageSizeCache];if(a&&a.has(o)){var c=a.get(o);if(c)return c}a||(a=new Map,e[r.imageSizeCache]=a);var l=function(e){var t=e[r.imageSizesIndex];return t||(t=Object.values(e).sort((function(e,t){return e.width-t.width||e.height-t.height})),e[r.imageSizesIndex]=t),t}(e).filter((function(e){return!e.theme||e.theme===n})),d=l.find((function(e){return e.width>=t&&e.height>=i}))||l[l.length-1];return a.set(o,d),d},o=function(e,t,i,o){return void 0===o&&(o=r.Theme.DEFAULT),function(e,t){return e.image.base_url+"/"+t.id+(e.image.version?"?"+e.image.version:"")}(e,function(e,t,i){return void 0===i&&(i=r.Theme.DEFAULT),s(n.STICKER_IMAGE,e,t,i)}(t,i,o))},a=function(e,t){return void 0===t&&(t=r.Theme.DEFAULT),e.animation?e.animation.base_url+"/"+n.STICKER_ANIMATION[t]+(e.animation.version?"?"+e.animation.version:""):""},c=function(e,t,i,o){return void 0===o&&(o=r.Theme.DEFAULT),function(e,t){return e.icon.base_url+"/"+t.id+(e.thumb.version?"?"+e.thumb.version:"")}(e,function(e,t,i){return void 0===i&&(i=r.Theme.DEFAULT),s(n.STICKER_PACK_ICON,e,t,i)}(t,i,o))},l=function(e){return e.recipient_id===n.SAMPLE_RECIPIENT_ID}},665820:(e,t,i)=>{"use strict";i.d(t,{getCache:()=>l,updateCache:()=>d,getSticker:()=>u,getStickers:()=>_,getPackByStickerId:()=>m});var r=i(570655),n=i(293680),s=i(654921),o=i(749091),a=i(310835),c=i(26330),l=function(){if(!window.stickersCache){var e=c.default.get("stickers_cache");window.stickersCache=(0,r.__assign)((0,r.__assign)({},s.DEFAULT_CACHE),e)}return window.stickersCache},d=function(e){window.stickersCache=(0,r.__assign)((0,r.__assign)({},l()),e)},u=function(e){return l().stickers.get(e)},_=function(e){var t=l().stickers;return e.map((function(e){return t.get(e)}))},f=function(e){var t=u(e);if(!t||!t.pack_id)return null;var i=(0,a.getProductFromCache)(t.pack_id);return i&&(0,o.isBasePack)(i)?i:null},m=function(e){var t=f(e);return t?Promise.resolve(t):new Promise((function(t){n.ajax.post("stickers.php",{act:"get_products",sticker_ids:[e]},{onDone:function(i){(0,a.cacheProductsData)(i),t(f(e))},onFail:function(e){return console.error(e),t(null),!0}})}))}},399321:(e,t,i)=>{"use strict";i.d(t,{Cart:()=>c});var r=i(570655),n=i(293680),s=i(236783),o=i(654921),a=i(310835),c=function(){function e(e,t){void 0===t&&(t=[]),this.loadTimeout=null,this.loadCancellationToken=null,this.isGift=!1,this.onChange=null,this._order=null,this.setItems(e),this.recipientIds=new Set(t),this.recipients=new Map}return e.create=function(t,i){return void 0===i&&(i=[]),new e(t.map((function(e){return{product_id:e,amount:1}})),i)},e.prototype.copy=function(){var t=new e(this.getItems(),this.getRecipientIds());return t.setOrder(this.getOrder()),t},e.prototype.getItems=function(){return Array.from(this.items.values())},e.prototype.setItems=function(e){this.items=new Map(e.map((function(e){return[e.product_id,e]})))},e.prototype.loadItems=function(){var e=this,t=Array.from(this.items.keys());return(0,a.getProducts)(t).then((function(){var t,i;try{for(var n=(0,r.__values)(Array.from(e.items.values())),s=n.next();!s.done;s=n.next()){var o=s.value;o.product=(0,a.getProductFromCache)(o.product_id)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}))},e.prototype.getProducts=function(){return(0,a.getProductsFromCache)(Array.from(this.items.keys()))},e.prototype.hasProduct=function(e){return this.items.has(e)},e.prototype.addProduct=function(e,t){if(void 0===t&&(t=!1),!this.hasProduct(e)){var i={product_id:e,amount:1};t?this.setItems((0,r.__spreadArray)((0,r.__spreadArray)([],(0,r.__read)(this.getItems())),[i])):this.setItems((0,r.__spreadArray)([i],(0,r.__read)(this.getItems()))),this.onChange&&this.onChange()}},e.prototype.removeProduct=function(e){this.hasProduct(e)&&(this.items.delete(e),this.onChange&&this.onChange())},e.prototype.getRecipientIds=function(e){return void 0===e&&(e=!1),this.recipientIds.size?Array.from(this.recipientIds.values()):this.isGift&&e?[o.SAMPLE_RECIPIENT_ID]:[]},e.prototype.setRecipientIds=function(e){this.recipientIds=new Set(e)},e.prototype.hasRecipientId=function(e){return this.recipientIds.has(e)},e.prototype.addRecipientId=function(e){this.hasRecipientId(e)||(this.recipientIds.add(e),this.onChange&&this.onChange())},e.prototype.removeRecipientId=function(e){this.hasRecipientId(e)&&(this.recipientIds.delete(e),this.onChange&&this.onChange())},e.prototype.setOrder=function(e){var t,i;if(this._order=e,e){this.recipientIds.clear();try{for(var n=(0,r.__values)(e.items),s=n.next();!s.done;s=n.next()){var a=s.value;a.recipient_id!==o.SAMPLE_RECIPIENT_ID&&this.recipientIds.add(a.recipient_id)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}},e.prototype.loadOrder=function(e){var t=e.items.map((function(e){return e.product_id}));return(0,a.getProducts)(t).then((function(t){return(0,r.__assign)((0,r.__assign)({},e),{items:e.items.map((function(e,i){return(0,r.__assign)((0,r.__assign)({},e),{product:t[i]})}))})}),(function(){return e}))},e.prototype.getOrder=function(){return this._order},e.prototype.getRecipientsMap=function(){return this.recipients},e.prototype.getRecipients=function(){return Array.from(this.recipients.values())},e.prototype.getRecipientById=function(e){return this.recipients.get(e)},e.prototype.addRecipients=function(e){this.recipients=new Map((0,r.__spreadArray)((0,r.__spreadArray)([],(0,r.__read)(this.getRecipients())),(0,r.__read)(e)).map((function(e){return[e[0],e]})))},e.prototype.getJSON=function(){return JSON.stringify({items:this.getItems().map((function(e){return(0,r.__assign)((0,r.__assign)({},e),{product:void 0})})),recipient_ids:this.getRecipientIds(!0)})},e.prototype.isLoaded=function(){return null!==this.getOrder()},e.prototype.cancelLoad=function(){this.loadTimeout&&(window.clearTimeout(this.loadTimeout),this.loadTimeout=null),this.loadCancellationToken&&(this.loadCancellationToken.cancel(),this.loadCancellationToken=null)},e.prototype.load=function(e){var t=this;return void 0===e&&(e=!1),this.cancelLoad(),new Promise((function(i){t.loadTimeout=window.setTimeout((function(){t.loadCancellationToken=new s.AjaxCancellationToken,n.ajax.post("stickers.php",{act:"preview_products_order",cart:t.getJSON(),with_suggested_recipients:e?1:0},{cancellationToken:t.loadCancellationToken,onDone:function(e){(0,a.cacheProductsData)(e),Promise.all([t.loadItems(),t.loadOrder(e.order)]).then((function(n){var s=(0,r.__read)(n,2)[1];t.setOrder(s),e.recipients&&t.addRecipients(e.recipients),i(t)}),(function(){}))},onFail:function(e){return e&&window.__dev&&console.error(e),i(t),!0}})}),300)}))},e.prototype.order=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(i){var s;n.ajax.post("stickers.php",{act:"order_products",cart:t.getJSON(),hash:e.hash||(null===(s=t.getOrder())||void 0===s?void 0:s.hash),message:e.message,is_private:e.is_private?1:0,ref:e.ref,gift_ref:e.gift_ref},{onDone:function(e){(0,a.cacheProductsData)(e),Promise.all([t.loadOrder(e.order),t.loadOrder(e.result)]).then((function(e){var n=(0,r.__read)(e,2),s=n[0],o=n[1];t.setOrder(s),i(o)}),(function(){}))},onFail:function(e){return e&&console.error(e),i(null),!0}})}))},e}()},360989:(e,t,i)=>{"use strict";i.d(t,{default:()=>d});var r=i(570655),n=i(667294),s=i(748759),o=i(483295),a=i(749091),c=i(330494),l=i(166347);const d=function(e){var t=e.className,i=e.sticker,d=e.theme,u=void 0===d?a.Theme.LIGHT:d,_=e.width,f=e.height,m=(0,r.__read)((0,s.useInView)({threshold:0}),2),h=m[0],p=m[1],g=void 0!==i.animation,v=(0,r.__read)(n.useState(!1),2),k=v[0],S=v[1];return n.createElement("div",{className:(0,o.classNames)("Sticker",t),ref:h,onMouseEnter:function(){S(!0)},onMouseLeave:function(){S(!1)}},g?n.createElement(l.default,{sticker:i,theme:u,width:_,height:f,isInView:p,play:k}):n.createElement(c.default,{sticker:i,theme:u,width:_,height:f,isInView:p}))}},166347:(e,t,i)=>{"use strict";i.d(t,{default:()=>l});var r=i(570655),n=i(667294),s=i(483295),o=i(211248),a=i.n(o),c=i(922377);const l=function(e){var t=e.className,i=e.sticker,o=e.theme,l=e.width,d=e.height,u=e.isInView,_=void 0===u||u,f=e.play,m=void 0!==f&&f,h=n.useRef(null),p=(0,r.__read)(n.useState(null),2),g=p[0],v=p[1],k=(0,c.getStickerAnimationUrl)(i,o);return n.useEffect((function(){if(g&&g.isLoaded){var e=m&&_;e&&!g.playing&&(g.item.play(),v((0,r.__assign)((0,r.__assign)({},g),{playing:!0}))),!e&&g.playing&&(g.item.pause(),v((0,r.__assign)((0,r.__assign)({},g),{playing:!1})))}}),[g,m,_]),n.useEffect((function(){if(!g||g.url!==k)if(g&&g.item.destroy(),k&&_){var e=a().loadAnimation({container:h.current,path:k,renderer:"svg",autoplay:!1,loop:!0,rendererSettings:{className:"StickerAnimation__animation",progressiveLoad:!0,hideOnTransparent:!0}}),t={url:k,isLoaded:!1,item:e,playing:!1};e.addEventListener("DOMLoaded",(function(){v((0,r.__assign)((0,r.__assign)({},t),{isLoaded:!0}))})),v(t)}else v(null)}),[k,_]),n.createElement("div",{className:(0,s.classNames)("StickerAnimation",t),style:{width:l,height:d},ref:h})}},330494:(e,t,i)=>{"use strict";i.d(t,{default:()=>o});var r=i(667294),n=i(483295),s=i(922377);const o=function(e){var t=e.className,i=e.sticker,o=e.theme,a=e.width,c=e.height,l=e.isInView,d=void 0===l||l,u=r.useRef(null),_=(0,s.getStickerImageUrl)(i,a,c,o);return r.useLayoutEffect((function(){u.current&&u.current.src!==_&&d&&(u.current.src=_)}),[d,_]),r.createElement("div",{className:(0,n.classNames)("StickerImage",t),style:{width:a,height:c}},r.createElement("img",{className:"StickerImage__image",ref:u}))}},60578:(e,t,i)=>{"use strict";i.d(t,{default:()=>P});var r=i(570655),n=i(667294),s=i(486125),o=i(654612),a=i(786067),c=i(41650),l=i(213984),d=i(288420),u=i(118690),_=i(733024),f=i(686478),m=i(749091),h=i(654921),p=i(665820),g=i(348230),v=i(451322),k=i(683791),S=i(155639),w=i(450134),y=i(360989),E=i(295565),C=i(54637),T=i(369783),b=i(870264),j=i(511417),I=c.default.getLang;const P=function(e){var t=e.pack,i=e.cart,c=e.options,P=c.recipientIds,R=void 0===P?[]:P,N=c.ref,x=c.gift_ref,L=e.closeBox,O=(0,r.__read)((0,v.usePack)(t.id),1)[0];O&&(t=O);var B=(0,r.__read)((0,k.useStyles)(t.style_ids||[]),2),A=B[0],H=B[1],M=(0,r.__read)((0,w.useCart)((function(){return i})),2),D=M[0],F=M[1],K=(0,r.__read)((0,S.useWithProducts)(D.getItems()),1)[0],G=D.getProducts(),z=D.getOrder(),W=(0,p.getSticker)(t.sticker_ids[0]),U=function(e){var t,i;if(!e)return null;var n=[],s=[];try{for(var o=(0,r.__values)(e.items),c=o.next();!c.done;c=o.next()){var l=c.value,d=l.product,u=l.error;d&&!u&&((0,m.isPackProduct)(d)?n.push(l):(0,m.isStyleProduct)(d)&&s.push(l))}}catch(e){t={error:e}}finally{try{c&&!c.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}var _=s.reduce((function(e,t){var i;return e+((null===(i=t.price)||void 0===i?void 0:i.current)||0)}),0);if(n.length){var f=n.reduce((function(e,t){var i;return e+((null===(i=t.price)||void 0===i?void 0:i.current)||0)}),0);return f?s.length?_?(0,a.langStr)(I("purchases_stickers_order_summary_pack_for_styles_for",s.length),"pack_price",I("global_n_votes",f),"styles_num",s.length,"styles_price_sum",_):(0,a.langStr)(I("purchases_stickers_order_summary_pack_for_styles_free",s.length),"pack_price",I("global_n_votes",f),"styles_num",s.length):(0,a.langStr)(I("purchases_stickers_order_summary_pack_for"),"pack_price",I("global_n_votes",f)):s.length?_?(0,a.langStr)(I("purchases_stickers_order_summary_pack_free_styles_for",s.length),"styles_num",s.length,"styles_price_sum",I("global_n_votes",_)):(0,a.langStr)(I("purchases_stickers_order_summary_pack_free_styles_free",s.length),"styles_num",s.length):(0,a.langStr)(I("purchases_stickers_order_summary_pack_free"))}if(s.length)return _?(0,a.langStr)(I("purchases_stickers_order_summary_styles_for",s.length),"styles_num",s.length,"styles_price_sum",I("global_n_votes",_)):(0,a.langStr)(I("purchases_stickers_order_summary_styles_free",s.length),"styles_num",s.length);return null}(z),V=!F&&z&&!z.error,$=(0,r.__read)((0,n.useState)(!1),2),Y=$[0],q=$[1],J=null;if(z)if(z.error){if(z.error===h.ORDER_ERRORS.NOT_SIGNED_IN){J=n.createElement(u.default,{className:"StickerPackPreview__purchase",size:"m",loading:F,onClick:function(){(0,s.showDoneBox)(I("purchases_please_sign_in").replace(/\{link\}(.*?)\{\/link\}/,"<a href=\"/join\" onclick=\"return !showBox('join.php', { act: 'box', from: nav.strLoc }, {}, event)\">$1</a>"))}},I("purchases_stickers_get_pack_btn"))}else if(z.error===h.ORDER_ERRORS.NO_VALID_ITEMS){if(1===z.items.length){var X=z.items[0],Q=X.product,Z=X.error;if(Q&&Z!==h.ORDER_ITEM_ERRORS.DUPLICATE_PRODUCT&&Q.purchase_details){var ee=Q.purchase_details,te=ee.label,ie=ee.title,re=ee.text,ne=ee.button_title,se=ee.button_url;J=n.createElement(u.default,{className:"StickerPackPreview__purchase",size:"m",appearance:"primary",loading:F,onClick:function(){(0,o.showFastBox)(ie||I("purchases_stickers_catalog_purchase_details_title"),re,se&&ne||null,se?function(){window.location.href=se}:null)}},te||I("purchases_stickers_product_unavailable"))}}if(!J){var oe=!z.items.find((function(e){return e.error!==h.ORDER_ITEM_ERRORS.DUPLICATE_PRODUCT}));J=n.createElement(u.default,{className:"StickerPackPreview__purchase",size:"m",appearance:"secondary",loading:F,disabled:!0},I(oe?"purchases_stickers_product_purchased":"purchases_stickers_product_unavailable"))}}}else{var ae=F||Y;J=n.createElement(T.default,{className:"StickerPackPreview__purchase",size:"m",loading:ae,disabled:ae,price:z.price,text:z.price.current?I("purchases_stickers_buy_for"):I("purchases_stickers_get_for_free"),onClick:function(){Y||(q(!0),D.order({ref:N,gift_ref:x}).then((function(e){q(!1),e&&!e.error&&(0,s.showDoneBox)((0,g.getPurchaseResult)(e))}),(function(){})))}})}var ce=!F&&void 0!==G.find((function(e){return null==e?void 0:e.can_gift})),le=K.reduce((function(e,t){return t.product&&t.product.copyright&&e.add(t.product.copyright),e}),new Set),de=j.colorScheme.isDarkScheme()?m.Theme.DARK:m.Theme.LIGHT;return n.createElement("article",{className:"StickerPackPreview"},n.createElement("header",{className:"StickerPackPreview__header"},n.createElement("a",{className:"StickerPackPreview__close",onClick:L},n.createElement(_.default,null)),W&&n.createElement(y.default,{className:"StickerPackPreview__icon",sticker:W,theme:de,width:128,height:128}),n.createElement("div",{className:"StickerPackPreview__info"},n.createElement(l.default,{element:"h1",className:"StickerPackPreview__title"},t.title),n.createElement(l.default,{element:"div",className:"StickerPackPreview__author"},t.author),n.createElement(l.default,{element:"div",className:"StickerPackPreview__description"},t.description))),A.length>0&&n.createElement(E.default,{className:"StickerPackPreview__styles",styles:A,isLoading:H,isAdded:function(e){return D.hasProduct(e.id)},add:function(e){return D.addProduct(e.id)},remove:function(e){return D.removeProduct(e.id)},gift:function(e){return t=e.id,void(0,b.giftStickerProducts)([t],R);var t}}),n.createElement("div",{className:"StickerPackPreview__footerContainer"},n.createElement("section",{className:"StickerPackPreview__items"},K.map((function(e){return n.createElement(C.default,{item:e,showHeader:A.length>0,remove:e.product&&(0,m.isStyleProduct)(e.product)?function(){return D.removeProduct(e.product_id)}:void 0,key:e.product_id})}))),le.size>0&&n.createElement("section",{className:"StickerPackPreview__copyrights"},Array.from(le).map((function(e,t){return n.createElement("div",{key:t,className:"StickerPackPreview__copyright"},e)}))),n.createElement("footer",{className:"StickerPackPreview__footer"},!F&&(V||ce)&&n.createElement("div",{className:"StickerPackPreview__footerNote"},U),n.createElement("div",{className:"StickerPackPreview__footerButtons"},ce&&n.createElement(d.default,{className:"StickerPackPreview__gift",appearance:"primary",size:"m",onClick:function(){return(e=D.copy()).setRecipientIds(R),void(0,b.giftStickersCart)(e);var e}},n.createElement(f.default,{width:20,height:20,className:"StickerPackPreview__giftIcon"}),I("purchases_stickers_gift")),J))))}},187925:(e,t,i)=>{"use strict";i.d(t,{default:()=>y});var r=i(570655),n=i(667294),s=i(786067),o=i(41650),a=i(743927),c=i(439664),l=i(288420),d=i(118690),u=i(213984),_=i(749091),f=i(310835),m=i(399321),h=i(451322),p=i(683791),g=i(295565),v=i(190291),k=i(369783),S=i(870264),w=o.default.getLang;const y=function(e){var t=e.pack,i=e.options,o=e.closeBox,y=e.updateBox,E=(0,r.__read)((0,h.usePack)(t.id),2),C=E[0],T=E[1];C&&(t=C);var b=(0,r.__read)((0,p.useStyles)(t.style_ids||[]),2),j=b[0],I=b[1],P=T||I;(0,n.useEffect)((function(){y()}),[P]);var R=(0,r.__assign)((0,r.__assign)({},t),{base_id:t.id,title:w("purchases_stickers_product_preview_title_base_pack"),style_sticker_ids:t.sticker_ids}),N=(0,r.__spreadArray)([R],(0,r.__read)(j)),x=N.find((function(e){return e&&e.is_active}))||R,L=(0,r.__read)((0,n.useState)(),2),O=L[0],B=L[1],A=O&&N.find((function(e){return e&&e.id===O})),H=function(e){B(e&&e.id)},M=A||x,D=M===R?w("purchases_stickers_product_preview_title_base_pack"):(0,s.langStr)(w("purchases_stickers_product_preview_title_style"),"title",M.title);(0,n.useEffect)((function(){M.is_new&&(0,f.updateUserProductState)(M.id,_.UserProductStateKey.IsNew,0).finally((function(){}))}),[M,M.is_new]);var F=(0,r.__read)((0,n.useState)(!1),2),K=F[0],G=F[1],z=(0,r.__read)((0,n.useState)(!1),2),W=z[0],U=z[1];return n.createElement("article",{className:"StickerPackSettings"},n.createElement(a.ModalHeader,{className:"StickerPackSettings__header",title:t?(0,s.langStr)(w("purchases_stickers_style_selection_for_pack"),"title",t.title):"",onClose:o}),P?n.createElement("section",{className:"StickerPackSettings__content StickerPackSettings__content--loading"},n.createElement(c.default,{size:24})):n.createElement(n.Fragment,null,N.length>0&&n.createElement(g.default,{className:"StickerPackSettings__styles",styles:N,isLoading:I,activeStyle:x,selectedStyle:M,select:function(e){return H(e)}}),n.createElement("div",{className:"StickerPackSettings__footerContainer"},n.createElement("section",{className:"StickerPackSettings__stylePreview"},n.createElement(u.default,{element:"h2",className:"StickerPackSettings__stylePreviewTitle"},D),n.createElement(v.default,{product:M})),n.createElement("footer",{className:"StickerPackSettings__footer"},n.createElement("div",{className:"StickerPackSettings__footerButtons"},M.can_gift&&n.createElement(l.default,{className:"StickerPackSettings__gift",appearance:"secondary",size:"m",onClick:function(){return e=M.id,void(0,S.giftStickerProducts)([e],i.recipientIds||[]);var e}}),M.is_purchased?n.createElement(d.default,{className:"StickerPackSettings__activate",appearance:"primary",size:"m",disabled:M===x,loading:W,onClick:function(){return e=M,void(W||(U(!0),(0,f.activateProduct)(e).then((function(){U(!1),H(void 0)}),(function(){}))));var e}},w("purchases_stickers_product_settings_save")):n.createElement(k.default,{className:"StickerPackSettings__buy",appearance:"primary",size:"m",price:M.price.purchase,text:w(M.price.purchase.current?"purchases_stickers_buy_for":"purchases_stickers_get_for_free"),loading:K,onClick:function(){return e=M,void(K||(G(!0),m.Cart.create([e.id]).order().then((function(){G(!1)}),(function(){}))));var e}}))))))}},490808:(e,t,i)=>{"use strict";i.d(t,{default:()=>w});var r=i(570655),n=i(667294),s=i(486125),o=i(786067),a=i(41650),c=i(743927),l=i(439664),d=i(273947),u=i(674041),_=i(479806),f=i(599940),m=i(749091),h=i(922377),p=i(450134),g=i(820159),v=i(945752),k=i(369783),S=a.default.getLang;const w=function(e){var t=e.cart,i=e.options,a=i.ref,w=i.gift_ref,y=e.closeBox,E=e.updateBox,C=(0,r.__read)((0,p.useCart)(t),2),T=C[0],b=C[1],j=!T.isLoaded()&&b;(0,n.useEffect)((function(){E()}),[j]);var I=T.getRecipientIds(),P=T.getOrder(),R=P&&!P.error&&P.items.find((function(e){return!e.error&&!(0,h.isSampleOrderItem)(e)})),N=(0,r.__read)(function(e){var t,i,n;if(!e)return[null,null];try{for(var s=(0,r.__values)(e.items),a=s.next();!a.done;a=s.next()){var c=a.value.product;if(c&&(0,m.isPackProduct)(c)){n=c;break}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(t)throw t.error}}var l=e.items.filter((function(e){var t=e.product;return null==t?void 0:t.can_gift})),d=l.filter((function(e){return!e.error&&!(0,h.isSampleOrderItem)(e)}));d.length&&(l=d);var u=new m.ProductsByType(l.map((function(e){return e.product}))),_=u.pack.values().next().value,f=Array.from(u.style),p="",g="";if(1===f.length)p=(0,o.langStr)(S("purchases_stickers_gift_title_1_style"),"title",f[0].title),_?g=(0,o.langStr)(S("purchases_stickers_gift_description_with_pack"),"title",_.title):n&&(g=(0,o.langStr)(S("purchases_stickers_gift_description_for_pack"),"title",n.title));else if(_){if(p=(0,o.langStr)(S("purchases_stickers_gift_title_pack"),"title",_.title),f.length)switch(f.length){case 2:g=(0,o.langStr)(S("purchases_stickers_gift_description_with_2_styles"),"title1",f[0].title,"title2",f[1].title);break;case 3:g=(0,o.langStr)(S("purchases_stickers_gift_description_with_3_styles"),"title1",f[0].title,"title2",f[1].title,"title3",f[2].title);break;case 4:g=(0,o.langStr)(S("purchases_stickers_gift_description_with_3_styles_and_1_more"),"title1",f[0].title,"title2",f[1].title,"title3",f[2].title);break;default:var v=f.length-3;g=(0,o.langStr)(S("purchases_stickers_gift_description_with_3_styles_and_n_more",v),"title1",f[0].title,"title2",f[1].title,"title3",f[2].title,"n",v)}}else if(f.length){switch(f.length){case 2:p=(0,o.langStr)(S("purchases_stickers_gift_title_2_styles"),"title1",f[0].title,"title2",f[1].title);break;case 3:p=(0,o.langStr)(S("purchases_stickers_gift_title_3_styles"),"title1",f[0].title,"title2",f[1].title,"title3",f[2].title);break;case 4:p=(0,o.langStr)(S("purchases_stickers_gift_title_3_styles_and_1_more"),"title1",f[0].title,"title2",f[1].title,"title3",f[2].title);break;default:v=f.length-3;p=(0,o.langStr)(S("purchases_stickers_gift_title_3_styles_and_n_more",v),"title1",f[0].title,"title2",f[1].title,"title3",f[2].title,"n",v)}n&&(g=(0,o.langStr)(S("purchases_stickers_gift_description_for_pack"),"title",n.title))}f.length?g+=" "+S("purchases_stickers_gift_description_styles"):g+=" "+S("purchases_stickers_gift_description");return[p,g]}(P),2),x=N[0],L=N[1],O=(0,r.__read)((0,n.useState)(null),2)[1];(0,n.useLayoutEffect)((function(){var e,t,i=T.getRecipients();if(O(window.WideDropdown.init("StickerProductsGiftRecipientsDropdown",{defaultItems:i,items:i,noResult:S("gifts_nobody_found"),introText:S("gifts_start_typing_recipient"),maxItems:20,onChange:function(e,t){1===e?T.addRecipientId(+t):T.removeRecipientId(+t)}})),I.length)try{for(var n=(0,r.__values)(I),s=n.next();!s.done;s=n.next()){var o=s.value,a=T.getRecipientById(o);a&&window.WideDropdown.select("StickerProductsGiftRecipientsDropdown",!1,a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}else window.WideDropdown.focus("StickerProductsGiftRecipientsDropdown");return function(){window.WideDropdown.deinit("StickerProductsGiftRecipientsDropdown")}}),[j]);var B=(0,r.__read)((0,n.useState)(""),2),A=B[0],H=B[1],M=(0,r.__read)((0,n.useState)(!1),2),D=M[0],F=M[1],K=(0,r.__read)((0,n.useState)(!1),2),G=K[0],z=K[1],W=function(){G||(z(!0),T.order({message:A,is_private:D,ref:a,gift_ref:w}).then((function(e){z(!1),e&&!e.error&&((0,s.showDoneBox)(function(e,t){var i,n,s=new m.ProductsByType(e.items.filter((function(e){return!e.error})).map((function(e){return e.product}))),a=function(e){var t=e.getPack(),i=e.getStyles();if(t)return i.length?(0,o.langStr)(S("purchases_stickers_gift_result_products_pack_and_styles",i.length),"title",t.title,"styles_num",i.length):(0,o.langStr)(S("purchases_stickers_gift_result_products_pack"),"title",t.title);if(i.length)switch(i.length){case 1:return(0,o.langStr)(S("purchases_stickers_gift_result_products_1_style"),"title",i[0].title);case 2:return(0,o.langStr)(S("purchases_stickers_gift_result_products_2_styles"),"title1",i[0].title,"title2",i[1].title);case 3:return(0,o.langStr)(S("purchases_stickers_gift_result_products_3_styles"),"title1",i[0].title,"title2",i[1].title,"title3",i[2].title);case 4:return(0,o.langStr)(S("purchases_stickers_gift_result_products_3_styles_and_1_more"),"title1",i[0].title,"title2",i[1].title,"title3",i[2].title);default:var r=i.length-3;return(0,o.langStr)(S("purchases_stickers_gift_result_products_3_styles_and_n_more",r),"title1",i[0].title,"title2",i[1].title,"title3",i[2].title,"n",r)}return null}(s);if(!a)return null;var c=new Set;try{for(var l=(0,r.__values)(e.items),d=l.next();!d.done;d=l.next()){var u=d.value,_=u.error,f=u.recipient_id;if(!_){var h=t(f);h&&c.add(h)}}}catch(e){i={error:e}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(i)throw i.error}}var p=function(e,t){var i=Array.from(e.values());switch(i.length){case 0:return null;case 1:var r=1===t?"purchases_stickers_gift_result_1_recipient_single":"purchases_stickers_gift_result_1_recipient_multiple";return(0,o.langStr)((0,o.langSex)(i[0][7],S(r,!0)),"name",i[0][8]);case 2:return(0,o.langStr)(S("purchases_stickers_gift_result_2_recipients",t),"name1",i[0][8],"name2",i[1][8]);case 3:return(0,o.langStr)(S("purchases_stickers_gift_result_3_recipients",t),"name1",i[0][8],"name2",i[1][8],"name3",i[2][8]);case 4:return(0,o.langStr)(S("purchases_stickers_gift_result_4_recipients",t),"name1",i[0][8],"name2",i[1][8],"name3",i[2][8],"name4",i[3][8]);case 5:return(0,o.langStr)(S("purchases_stickers_gift_result_5_recipients",t),"name1",i[0][8],"name2",i[1][8],"name3",i[2][8],"name4",i[3][8],"name5",i[4][8]);default:var n=i.length-4;r=1===t?"purchases_stickers_gift_result_4_recipients_and_n_more_single":"purchases_stickers_gift_result_4_recipients_and_n_more_multiple";return(0,o.langStr)(S(r),"name1",i[0][8],"name2",i[1][8],"name3",i[2][8],"name4",i[3][8],"n",n)}return null}(c,s.getCount());if(!p)return null;return(0,o.langStr)(p,"products",a)}(e,(function(e){return T.getRecipientById(e)}))),y())}),(function(){})))};return(0,n.useEffect)((function(){window.WideDropdown.disable("StickerProductsGiftRecipientsDropdown",G)}),[G]),n.createElement("article",{className:"StickerProductsGift"},n.createElement(c.ModalHeader,{className:"StickerProductsGift__header",title:S("purchases_stickers_gift_box_title"),onClose:y}),j?n.createElement("section",{className:"StickerProductsGift__content StickerProductsGift__content--loading"},n.createElement(l.default,{size:24})):n.createElement(n.Fragment,null,n.createElement("section",{className:"StickerProductsGift__content"},n.createElement(g.default,{order:P,forceValid:!R}),n.createElement("h1",{className:"StickerProductsGift__productsTitle"},x),n.createElement("p",{className:"StickerProductsGift__productsDescription"},L),P&&n.createElement(n.Fragment,null,n.createElement("dl",{className:"StickerProductsGift__price"},n.createElement("dt",{className:"StickerProductsGift__priceLabel"},S("purchases_gift_price_label"))," ",n.createElement("dd",{className:"StickerProductsGift__priceValue"},S("global_n_votes",P.price.current))),n.createElement("div",{className:"StickerProductsGift__balance"},(0,o.langStr)(S("gifts_you_have_X_votes"),"votes",S("global_n_votes",P.balance)))),n.createElement("div",{className:"StickerProductsGift__recipients"},n.createElement("label",{className:"StickerProductsGift__recipientsLabel",htmlFor:"StickerProductsGiftRecipientsInput"},S("gifts_receiver")),n.createElement("div",{className:"wdd StickerProductsGift__recipientsDropdown",id:"StickerProductsGiftRecipientsDropdown"},n.createElement("div",{className:"fl_r wdd_arr"}),n.createElement("input",{className:"wdd_text fl_l",id:"StickerProductsGiftRecipientsInput",placeholder:S("gifts_choose_recipients")}))),n.createElement("div",{className:"StickerProductsGift__message"},n.createElement("label",{className:"StickerProductsGift__messageLabel",htmlFor:"StickerProductsGiftMessageInput"},S("purchases_gift_your_message")),n.createElement(d.default,{className:"StickerProductsGift__messageInput",id:"StickerProductsGiftMessageInput",value:A,onChange:function(e){return H(e.currentTarget.value)},onResize:function(){return E()},style:{height:80},disabled:G})),n.createElement(u.default,{className:"StickerProductsGift__isPrivate",checked:D,disabled:G,onChange:function(){return F(!D)}},S("gifts_receiver_only"))),n.createElement("footer",{className:"StickerProductsGift__footer"},n.createElement("div",{className:"StickerProductsGift__footerNote"},!b&&P&&n.createElement("div",{className:"StickerProductsGift__details"},S("purchases_stickers_gift_details_label"),n.createElement(f.default,{className:"StickerProductsGift__detailsTooltip",text:n.createElement(v.default,{order:P,recipients:T.getRecipientsMap()}),position:"t",align:"center",appearance:"light"},n.createElement(_.default,{className:"StickerProductsGift__detailsHintIcon"})))),n.createElement("div",{className:"StickerProductsGift__footerButtons"},n.createElement(k.default,{className:"StickerProductsGift__gift",appearance:R?"primary":"secondary",size:"m",loading:b||G,disabled:!R,price:null==P?void 0:P.price,text:R?(0,o.langStr)(S("purchases_stickers_gift_send_for"),"price",S("global_n_votes",null==P?void 0:P.price.current)):S("purchases_stickers_gift_send"),onClick:function(){return W()}})))))}},945752:(e,t,i)=>{"use strict";i.d(t,{default:()=>u});var r=i(570655),n=i(667294),s=i(786067),o=i(41650),a=i(213984),c=i(749091),l=i(922377),d=o.default.getLang;const u=function(e){var t,i,o=e.order,u=e.recipients,_=function(e){var t,i;if(!e)return null;var n=e.items.filter((function(e){var t=e.product;return null==t?void 0:t.can_gift})),o=n.filter((function(e){return!e.error&&!(0,l.isSampleOrderItem)(e)}));o.length&&(n=o);var a=[],u=[];try{for(var _=(0,r.__values)(n),f=_.next();!f.done;f=_.next()){var m=f.value,h=m.product;h&&((0,c.isPackProduct)(h)?a.push(m):(0,c.isStyleProduct)(h)&&u.push(m))}}catch(e){t={error:e}}finally{try{f&&!f.done&&(i=_.return)&&i.call(_)}finally{if(t)throw t.error}}var p=u.reduce((function(e,t){var i;return e+((null===(i=t.price)||void 0===i?void 0:i.current)||0)}),0);if(a.length){var g=a.reduce((function(e,t){var i;return e+((null===(i=t.price)||void 0===i?void 0:i.current)||0)}),0);return u.length?(0,s.langStr)(d("purchases_stickers_gift_details_summary_pack_with_styles",u.length),"pack_price_sum",d("global_n_votes",g),"styles_num",u.length,"styles_price_sum",d("global_n_votes",p)):(0,s.langStr)(d("purchases_stickers_gift_details_summary_pack"),"pack_price_sum",d("global_n_votes",g))}if(u.length)return(0,s.langStr)(d("purchases_stickers_gift_details_summary_styles",u.length),"styles_num",u.length,"styles_price_sum",d("global_n_votes",p));return null}(o),f=new Map;try{for(var m=(0,r.__values)(o.items),h=m.next();!h.done;h=m.next()){var p=h.value,g=p.error,v=p.product,k=p.recipient_id;if(!g){var S=u.get(k);if(S){var w=f.get(S);w||(w=new c.ProductsByType,f.set(S,w)),w.add(v)}}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(i=m.return)&&i.call(m)}finally{if(t)throw t.error}}var y=Array.from(f.entries()),E=(0,n.useRef)(null);return(0,n.useEffect)((function(){var e=E.current;e&&(e.style.maxHeight=e.getBoundingClientRect().bottom-22+"px")})),n.createElement("div",{className:"StickerProductsGiftDetails",ref:E},_&&n.createElement(a.default,{element:"p",className:"StickerProductsGiftDetails__summary"},_),y.length>0&&n.createElement("ul",{className:"StickerProductsGiftDetails__recipients"},y.map((function(e){var t=(0,r.__read)(e,2),i=t[0],o=t[1];return n.createElement("li",{className:"StickerProductsGiftDetails__recipient",key:i[0]},n.createElement(a.default,{element:"div",className:"StickerProductsGiftDetails__recipientName"},i[1]),n.createElement("div",{className:"StickerProductsGiftDetails__recipientProducts"},function(e){var t=e.getPack(),i=e.getStyles(),r="";i.length&&(r=i.map((function(e){return(0,s.langStr)(d("purchases_stickers_gift_details_recipient_style_title"),"title",e.title)})).join(", "));if(t)return r?(0,s.langStr)(d("purchases_stickers_gift_details_recipient_pack_and_styles"),"pack_title",t.title,"style_titles",r):(0,s.langStr)(d("purchases_stickers_gift_details_recipient_pack"),"title",t.title);if(r)return(0,s.langStr)(d("purchases_stickers_gift_details_recipient_styles"),"style_titles",r);return null}(o)))}))))}},820159:(e,t,i)=>{"use strict";i.d(t,{default:()=>l});var r=i(570655),n=i(667294),s=i(483295),o=i(749091),a=i(922377),c={s:56,m:96,l:168};const l=function(e){var t,i,l,d,u,_=e.order,f=e.forceValid,m=void 0!==f&&f,h=new Map,p=new Map;if(_)try{for(var g=(0,r.__values)(_.items),v=g.next();!v.done;v=g.next()){var k=v.value,S=k.product;S&&((0,o.isPackProduct)(S)?h.has(S)?null===(l=h.get(S))||void 0===l||l.push(k):h.set(S,[k]):(0,o.isStyleProduct)(S)&&(p.has(S)?null===(d=p.get(S))||void 0===d||d.push(k):p.set(S,[k])))}}catch(e){t={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(t)throw t.error}}var w=h.keys().next().value,y=(w?1:0)+p.size,E=y>1?y>2?"s":"m":"l",C=c[E],T=Array.from(p.entries());m||T.sort((function(e,t){var i=(0,r.__read)(e,2)[1];return(0,r.__read)(t,2)[1].filter((function(e){return!e.error})).length-i.filter((function(e){return!e.error})).length}));var b=T.slice(0,3),j=T.slice(3),I=!0;if(!m){var P=j.filter((function(e){return(0,r.__read)(e,2)[1].find((function(e){return!e.error}))}));P.length?j=P:I=!1}return n.createElement("ul",{className:"StickerProductsGiftIcons"},w&&n.createElement("li",{className:(0,s.classNames)("StickerProductsGiftIcons__icon","StickerProductsGiftIcons__icon--"+E,"StickerProductsGiftIcons__icon--pack",{"StickerProductsGiftIcons__icon--invalid":!m&&!(null===(u=h.get(w))||void 0===u?void 0:u.find((function(e){return!e.error})))}),style:{backgroundImage:"url("+(0,a.getStickerPackIconUrl)(w,C,C)+")"},key:w.id}),b.map((function(e){var t=(0,r.__read)(e,2),i=t[0],o=t[1];return n.createElement("li",{className:(0,s.classNames)("StickerProductsGiftIcons__icon","StickerProductsGiftIcons__icon--"+E,"StickerProductsGiftIcons__icon--style",{"StickerProductsGiftIcons__icon--invalid":!m&&!o.find((function(e){return!e.error}))}),style:{backgroundImage:"url("+(0,a.getStickerPackIconUrl)(i,C,C)+")"},key:i.id})})),j.length?n.createElement("li",{className:(0,s.classNames)("StickerProductsGiftIcons__icon","StickerProductsGiftIcons__icon--"+E,"StickerProductsGiftIcons__icon--more",{"StickerProductsGiftIcons__icon--invalid":!I}),key:"more"},"+",j.length):null)}},618610:(e,t,i)=>{"use strict";i.d(t,{default:()=>d});var r=i(667294),n=i(786067),s=i(41650),o=i(743927),a=i(288420),c=i(190291),l=s.default.getLang;const d=function(e){var t=e.style,i=e.options.add,s=e.closeBox;return r.createElement("article",{className:"StickerStylePreview"},r.createElement(o.ModalHeader,{className:"StickerStylePreview__header",title:(0,n.langStr)(l("purchases_stickers_stickers_of_style"),"title",t.title),onClose:s}),r.createElement(c.default,{className:"StickerStylePreview__content",product:t}),r.createElement("footer",{className:"StickerStylePreview__footer"},r.createElement(a.default,{className:"StickerStylePreview__cancel",appearance:"tertiary",size:"m",onClick:s},l("global_cancel")),i&&r.createElement(a.default,{className:"StickerStylePreview__add",appearance:"primary",size:"m",onClick:function(){return i(t)}},l("purchases_stickers_preview_add_item"))))}},295565:(e,t,i)=>{"use strict";i.d(t,{default:()=>_});var r=i(667294),n=i(483295),s=i(41650),o=i(647560),a=i(599940),c=i(479806),l=i(290625),d=i(171134),u=s.default.getLang;const _=function(e){var t=e.className,i=e.styles,s=e.isLoading,_=e.isAdded,f=e.add,m=e.remove,h=e.gift,p=e.activeStyle,g=e.selectedStyle,v=e.select,k=(0,l.default)({wrapperSelector:".StickerStylesMenu__wrapper",itemSelector:".StickerStylesMenu__item"});if(s)return r.createElement("section",{className:(0,n.classNames)("StickerStylesMenu","StickerStylesMenu--loading",t)},r.createElement(o.default,{className:"StickerStylesMenu__progress"}));var S=[{title:u("purchases_stickers_purchased_styles"),styles:i.filter((function(e){return e.is_purchased&&!e.is_disabled}))},{title:u("purchases_stickers_other_styles"),styles:i.filter((function(e){return!e.is_purchased&&!e.is_disabled&&!e.is_hidden})),tooltip:u("purchases_stickers_styles_hint")}].filter((function(e){return e.styles.length}));return S.length?r.createElement("section",{className:(0,n.classNames)("StickerStylesMenu",t),ref:k.ref,onWheel:function(e){return k.onWheel(e)}},r.createElement("a",{className:(0,n.classNames)("StickerStylesMenu__nav","StickerStylesMenu__nav--prev",{"StickerStylesMenu__nav--disabled":!k.hasPrev}),onClick:function(){return k.prev()}}),r.createElement("a",{className:(0,n.classNames)("StickerStylesMenu__nav","StickerStylesMenu__nav--next",{"StickerStylesMenu__nav--disabled":!k.hasNext}),onClick:function(){return k.next()}}),r.createElement("div",{className:"StickerStylesMenu__wrapper"},S.map((function(e,t){return r.createElement("section",{className:"StickerStylesMenu__group",key:t},r.createElement("h2",{className:"StickerStylesMenu__groupTitle"},e.title,e.tooltip&&r.createElement(a.default,{className:"StickerStylesMenu__groupTitleHint",text:e.tooltip,position:"b",align:"center",appearance:"light"},r.createElement(c.default,{className:"StickerStylesMenu__groupTitleHintIcon"}))),r.createElement("div",{className:"StickerStylesMenu__groupItems"},e.styles.map((function(e){return r.createElement(d.default,{className:"StickerStylesMenu__item",style:e,isLoading:s,isAdded:_&&_(e),add:f&&function(){return f(e)},remove:m&&function(){return m(e)},gift:h&&function(){return h(e)},isActive:void 0===p?void 0:e===p,isSelected:void 0===g?void 0:e===g,select:v&&function(){return v(e)},key:e.id})}))))})))):null}},171134:(e,t,i)=>{"use strict";i.d(t,{default:()=>_});var r=i(667294),n=i(483295),s=i(41650),o=i(288420),a=i(213984),c=i(665820),l=i(686478),d=i(360989),u=s.default.getLang;const _=function(e){var t,i=e.className,s=e.style,_=e.isAdded,f=void 0!==_&&_,m=e.add,h=e.remove,p=e.gift,g=e.isActive,v=e.isSelected,k=e.select;t=s.is_new?s.title.trim().replace(/(^|\s)([^\s]+)$/,'$1<span class="StickerStylesMenuItem__titleLastWord">$2</span>'):s.title;var S=(0,c.getSticker)(s.style_sticker_ids[0]),w=function(e){return function(t){t.stopPropagation(),e()}};return r.createElement("div",{className:(0,n.classNames)("StickerStylesMenuItem",i,{"StickerStylesMenuItem--selected":Boolean(v),"StickerStylesMenuItem--added":Boolean(f),"StickerStylesMenuItem--new":s.is_new}),onClick:function(){k?k():f?h&&h():m&&m()}},S&&r.createElement(d.default,{className:"StickerStylesMenuItem__icon",sticker:S,width:100,height:100}),r.createElement(a.default,{element:"div",className:"StickerStylesMenuItem__title"},t),s.is_purchased?void 0===g?r.createElement("div",{className:"StickerStylesMenuItem__notice"},u("purchases_stickers_you_have_it")):g&&r.createElement("div",{className:"StickerStylesMenuItem__notice"},u("purchases_stickers_active_style")):s.price.purchase.regular?r.createElement("div",{className:"StickerStylesMenuItem__price"},u("global_n_votes",s.price.purchase.current)):r.createElement("div",{className:"StickerStylesMenuItem__price"},u("purchases_for_free_btn")),(m||h||p&&s.can_gift)&&r.createElement("div",{className:"StickerStylesMenuItem__actions"},f?h&&r.createElement(o.default,{className:"StickerStylesMenuItem__remove",appearance:"secondary",size:"s",onClick:w(h)},u("purchases_stickers_preview_remove_item")):m&&r.createElement(o.default,{className:"StickerStylesMenuItem__add",appearance:"primary",size:"s",onClick:w(m)},u("purchases_stickers_preview_add_item")),p&&s.can_gift&&r.createElement(o.default,{className:"StickerStylesMenuItem__gift",size:"s",appearance:"primary",onClick:w(p)},r.createElement(l.default,{width:20,height:20,className:"StickerStylesMenuItem__giftIcon"}))))}},54637:(e,t,i)=>{"use strict";i.d(t,{default:()=>d});var r=i(667294),n=i(786067),s=i(41650),o=i(213984),a=i(749091),c=i(190291),l=s.default.getLang;const d=function(e){var t=e.item,i=e.showHeader,s=void 0!==i&&i,d=e.remove;if(!t.product)return null;var u="";return(0,a.isPackProduct)(t.product)?u=(0,n.langStr)(l("purchases_stickers_product_preview_title_pack"),"title",t.product.title):(0,a.isStyleProduct)(t.product)&&(u=(0,n.langStr)(l("purchases_stickers_product_preview_title_style"),"title",t.product.title)),r.createElement("div",{className:"StickersCartItem"},s&&r.createElement("div",{className:"StickersCartItem__header"},r.createElement(o.default,{element:"span",className:"StickersCartItem__title"},u),d&&r.createElement("span",{className:"StickersCartItem__actions"},r.createElement("button",{className:"StickersCartItem__remove",onClick:function(){return d()}},l("purchases_stickers_preview_remove_item")))),r.createElement(c.default,{className:"StickersCartItem__preview",product:t.product}))}},369783:(e,t,i)=>{"use strict";i.d(t,{default:()=>u});var r=i(570655),n=i(667294),s=i(786067),o=i(483295),a=i(41650),c=i(118690),l=a.default.getLang,d=function(e){var t=e.className,i=e.price,a=e.text,d=e.placeholder,u=(0,r.__rest)(e,["className","price","text","placeholder"]),_=(0,n.useMemo)((function(){if(i){var e;i.current!==i.regular&&i.regular&&(e=n.createElement("span",{className:"StickersPriceButton__regular",key:"regular"},i.current?i.regular:(0,s.langStr)(l("purchases_stickers_n_for_m"),"%n","","%m",l("global_n_votes",i.regular))));var t=n.createElement("span",{className:"StickersPriceButton__current",key:"current"},i.current?l("global_n_votes",i.current):l("purchases_for_free_btn").toLowerCase());return a?a.split(/(\{regular_price\}|\{price\})/).map((function(i,r){return"{regular_price}"===i?e:"{price}"===i?t:i?n.createElement("span",{className:"StickersPriceButton__label",key:"label"+r},i):void 0})):[e,t]}return[d]}),[a,d,null==i?void 0:i.regular,null==i?void 0:i.current]);return n.createElement(c.default,(0,r.__assign)({className:(0,o.classNames)("StickersPriceButton",t)},u),_)};d.defaultProps=(0,r.__assign)({},c.default.defaultProps);const u=d},190291:(e,t,i)=>{"use strict";i.d(t,{default:()=>l});var r=i(667294),n=i(483295),s=i(511417),o=i(749091),a=i(665820),c=i(360989);const l=function(e){var t=e.className,i=e.product;if(!(0,o.isPackProduct)(i)&&!(0,o.isStyleProduct)(i))return null;var l=(0,a.getStickers)((0,o.isStyleProduct)(i)?i.style_sticker_ids:i.sticker_ids),d=s.colorScheme.isDarkScheme()?o.Theme.DARK:o.Theme.LIGHT;return r.createElement("div",{className:(0,n.classNames)("StickersProductPreview",t)},r.createElement("ul",{className:"StickersProductPreview__stickers"},l.map((function(e){return e&&r.createElement(c.default,{className:"StickersProductPreview__sticker",sticker:e,width:128,height:128,theme:d,key:e.id})}))))}},450134:(e,t,i)=>{"use strict";i.d(t,{useCart:()=>s});var r=i(570655),n=i(667294),s=function(e){var t=(0,r.__read)((0,n.useState)(e),2),i=t[0],s=t[1],o=(0,r.__read)((0,n.useState)(null),2),a=o[0],c=o[1],l=(0,n.useCallback)((function(){var e=i.load();c(e),e.then((function(t){s(t),c((function(t){return t===e?null:t}))}),(function(){}))}),[i]);return(0,n.useEffect)((function(){return i.onChange=l,i.isLoaded()||l(),function(){i.onChange=null,i.cancelLoad()}}),[i]),[i,null!==a]}},451322:(e,t,i)=>{"use strict";i.d(t,{usePack:()=>o});var r=i(570655),n=i(749091),s=i(516067),o=function(e){var t=(0,r.__read)((0,s.useProduct)(e),2),i=t[0],o=t[1];return i&&(0,n.isPackProduct)(i)?[i,o]:[void 0===i?void 0:null,o]}},516067:(e,t,i)=>{"use strict";i.d(t,{useProduct:()=>o});var r=i(570655),n=i(667294),s=i(310835),o=function(e){var t=(0,r.__read)((0,n.useState)({}),2)[1],i=(0,s.getProductFromCache)(e);return void 0===i?((0,s.getProduct)(e,!1).then((function(){return t({})}),(function(){})),[i,!0]):[i,!1]}},227110:(e,t,i)=>{"use strict";i.d(t,{useProducts:()=>o});var r=i(570655),n=i(667294),s=i(310835),o=function(e){var t=(0,r.__read)((0,n.useState)({}),2)[1],i=(0,s.getProductsFromCache)(e);return i.some((function(e){return void 0===e}))?((0,s.getProducts)(e,!1).then((function(){return t({})}),(function(){})),[i,!0]):[i,!1]}},290625:(e,t,i)=>{"use strict";i.d(t,{default:()=>l});var r=i(570655),n=i(667294),s={getOffset:function(){return{x:0,y:0}},scrollTo:function(){},scrollBy:function(){},onWheel:function(){},updateItems:function(){},hasPrev:!1,hasNext:!1,prev:function(){},next:function(){}};function o(e,t){switch(t.type){case"updateState":return(0,r.__assign)((0,r.__assign)({},e),t.state);case"updateNav":return t.hasPrev!==e.hasPrev||t.hasNext!==e.hasNext?(0,r.__assign)((0,r.__assign)({},e),{hasPrev:t.hasPrev,hasNext:t.hasNext}):e;default:throw new Error}}var a=function(e){for(var t=Array.from(e.entries()),i=0;i<t.length;i++){var n=(0,r.__read)(t[i],2),s=n[0],o=n[1];if(o&&o.intersectionRatio)return o.intersectionRatio<1?s:t[i-1]?t[i-1][0]:null}return null},c=function(e){for(var t=Array.from(e.entries()),i=t.length-1;i>=0;i--){var n=(0,r.__read)(t[i],2),s=n[0],o=n[1];if(o&&o.intersectionRatio)return o.intersectionRatio<1?s:t[i+1]?t[i+1][0]:null}return null};const l=function(e){var t=n.useRef(null),i=(0,r.__read)(n.useReducer(o,s),2),l=i[0],d=i[1],u=n.useCallback((function(e){d({type:"updateState",state:e})}),[d]),_=n.useCallback((function(i){if(t.current&&l.onMouseWheel&&t.current.removeEventListener("mousewheel",l.onMouseWheel),i){var n=i.querySelector(e.wrapperSelector);if(n){var s,o={x:0,y:0},_=new Map,f=function(t){var r=0;n.offsetWidth>i.offsetWidth&&(r=Math.max(0,Math.min(n.offsetWidth-i.offsetWidth,t.x)));var s=0;n.offsetHeight>i.offsetHeight&&(s=Math.max(0,Math.min(n.offsetHeight-i.offsetHeight,t.y))),n.style.transform="translate3d(-"+r+"px, -"+s+"px, 0)",n.style.transitionDuration=t.noTransition?"0s":"",o={x:r,y:s},e.onScroll&&e.onScroll(r,s)},m=function(e){f((0,r.__assign)((0,r.__assign)({},e),{x:o.x+e.x,y:o.y+e.y}))},h=function(e){e.deltaX&&e.preventDefault()};i.addEventListener("mousewheel",h),u((0,r.__assign)((0,r.__assign)({},l),{onMouseWheel:h,updateItems:function(){var t,n;s&&s.disconnect(),s=new IntersectionObserver((function(e){var t,i;try{for(var n=(0,r.__values)(e),s=n.next();!s.done;s=n.next()){var o=s.value;_.has(o.target)&&_.set(o.target,o)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}d({type:"updateNav",hasPrev:null!==a(_),hasNext:null!==c(_)})}),{root:i,threshold:[0,1]}),_.clear();try{for(var o=(0,r.__values)(i.querySelectorAll(e.itemSelector)),l=o.next();!l.done;l=o.next()){var u=l.value;_.set(u,null),s.observe(u)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}},getOffset:function(){return o},scrollTo:f,scrollBy:m,onWheel:function(e){m({x:e.deltaX,y:e.deltaY,noTransition:!0})},prev:function(){var e=a(_);if(e){var t=getComputedStyle(n),i=parseInt(t.paddingLeft)||0,r=parseInt(t.paddingTop)||0,s=n.getBoundingClientRect(),o=e.getBoundingClientRect();f({x:o.left-s.left-i,y:o.top-s.top-r})}},next:function(){var e=c(_);if(e){var t=getComputedStyle(n),r=parseInt(t.paddingBottom)||0,s=parseInt(t.paddingRight)||0,o=i.getBoundingClientRect(),a=n.getBoundingClientRect(),l=e.getBoundingClientRect();f({x:l.left-a.left-o.width+l.width+s,y:l.top-a.top-o.height+l.height+r})}}}))}}t.current=i}),[e.wrapperSelector,e.itemSelector,e.onScroll]);return n.useLayoutEffect((function(){l.updateItems()})),(0,r.__assign)({ref:_},l)}},683791:(e,t,i)=>{"use strict";i.d(t,{useStyles:()=>o});var r=i(570655),n=i(749091),s=i(227110),o=function(e){var t,i,o=(0,r.__read)((0,s.useProducts)(e),2),a=o[0],c=o[1],l=[];try{for(var d=(0,r.__values)(a),u=d.next();!u.done;u=d.next()){var _=u.value;_&&(0,n.isStyleProduct)(_)&&l.push(_)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=d.return)&&i.call(d)}finally{if(t)throw t.error}}return[l,c]}},155639:(e,t,i)=>{"use strict";i.d(t,{useWithProducts:()=>o});var r=i(570655),n=i(667294),s=i(227110);function o(e){var t=(0,r.__read)((0,s.useProducts)(e.map((function(e){return e.product_id}))),2),i=t[0],o=t[1];return[(0,n.useMemo)((function(){return e.map((function(e,t){return(0,r.__assign)((0,r.__assign)({},e),{product:i[t]})}))}),[e]),o]}},751595:(e,t,i)=>{"use strict";i.d(t,{previewSticker:()=>g,previewStickerProduct:()=>v});var r=i(570655),n=i(667294),s=i(973935),o=i(654612),a=i(786067),c=i(749091),l=i(310835),d=i(665820),u=i(399321),_=i(348230),f=i(60578),m=i(187925),h=i(618610),p=new Map;function g(e,t){(0,_.showLoader)(),(0,d.getPackByStickerId)(e).then((function(e){e?v(e.id,t):(0,_.hideLoader)()}),(function(){}))}function v(e,t){var i,d=(0,r.__assign)({},t);function g(){return null==i?void 0:i.bodyNode.querySelector(".StickersProductPreviewBox")}function v(){null==i||i.hide(),window.nav.objLoc[0].match(/^stickers\/(.*?)$/)&&window.nav.setLoc({0:"stickers"})}function k(){null==i||i.updateBoxCoords()}function S(e,t){var i=null,r=null;if((0,c.isPackProduct)(e))i=e.is_purchased&&(null==d?void 0:d.settings)?n.createElement(m.default,{pack:e,options:d,closeBox:v,updateBox:k}):n.createElement(f.default,{pack:e,cart:t,options:d,closeBox:v,updateBox:k}),r=e.name;else if((0,c.isStyleProduct)(e)){var o=(0,l.getProductFromCache)(e.base_id);if(o)return t.addProduct(o.id,!0),void S(o,t);i=n.createElement(h.default,{style:e,options:d,closeBox:v,updateBox:k}),r=e.name}var a=g();if(a&&i&&(s.render(i,a),r)){var u=window.nav.objLoc[0].split("/");"stickers"===u[0]&&u[1]!==r&&window.nav.setLoc({0:"stickers/"+r})}}(0,_.showLoader)();var w=u.Cart.create([e]);return Promise.all([w.load(),window.stManager.add(["stickers.css"])]).then((function(t){var n=(0,r.__read)(t,2),c=n[0];n[1];(0,_.hideLoader)();var d=(0,l.getProductFromCache)(e);d&&!d.is_disabled?((i=new o.MessageBox({hideButtons:!0,bodyStyle:"padding: 0; background: none;",width:640,onShow:function(){S(d,c),requestAnimationFrame((function(){k(),function(){if(p.has(e)){var t=(0,_.getBoxLayerWrap)();t&&(t.scrollTop=p.get(e)||0),p.delete(e)}}()}))},onBeforeHide:function(){!function(){var t=(0,_.getBoxLayerWrap)();t&&p.set(e,t.scrollTop)}()},onHideAttempt:function(){var e;return(e=g())&&s.unmountComponentAtNode(e),!0}})).content('<div class="StickersProductPreviewBox"></div>'),i.show()):(0,o.showFastBox)((0,a.getLang)("global_box_error_title"),(0,a.getLang)("purchases_stickers_product_not_found"))}),(function(){})),{hide:v}}},310835:(e,t,i)=>{"use strict";i.d(t,{cacheProductsData:()=>o,getProductFromCache:()=>a,getProductsFromCache:()=>c,getProducts:()=>d,getProduct:()=>u,activateProduct:()=>_,updateUserProductState:()=>f});var r=i(570655),n=i(293680),s=i(665820),o=function(e,t){var i,n,o,a,c,l;void 0===t&&(t=[]);var d=(0,s.getCache)();if(e.stickers){var u=d.stickers;try{for(var _=(0,r.__values)(e.stickers),f=_.next();!f.done;f=_.next()){var m=f.value;u.has(m.id)?u.set(m.id,(0,r.__assign)((0,r.__assign)({},u.get(m.id)),m)):u.set(m.id,m)}}catch(e){i={error:e}}finally{try{f&&!f.done&&(n=_.return)&&n.call(_)}finally{if(i)throw i.error}}}if(e.products)try{for(var h=(0,r.__values)(e.products),p=h.next();!p.done;p=h.next()){var g=p.value;d.products.set(g.id,g),d.productPromises.delete(g.id)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(a=h.return)&&a.call(h)}finally{if(o)throw o.error}}try{for(var v=(0,r.__values)(t),k=v.next();!k.done;k=v.next()){var S=k.value;d.products.has(S)||d.products.set(S,null),d.productPromises.delete(S)}}catch(e){c={error:e}}finally{try{k&&!k.done&&(l=v.return)&&l.call(v)}finally{if(c)throw c.error}}e.emoji&&window.Emoji&&window.Emoji.updateTabs(e.emoji.stickers,e.emoji.keywords,!0),(0,s.updateCache)(d)},a=function(e){return(0,s.getCache)().products.get(e)},c=function(e){var t=(0,s.getCache)().products;return e.map((function(e){return t.get(e)}))};var l=function(e){var t,i;if(!e.length)return Promise.resolve([]);var a,l=(0,s.getCache)(),d=l.productPromises,u=l.productIdsQueue,_=new Set;try{for(var f=(0,r.__values)(e),m=f.next();!m.done;m=f.next()){var h=m.value;if(d.has(h)){(p=d.get(h))&&_.add(p)}else{u.add(h);var p=(a=void 0,(a=(0,s.getCache)().productsPromise)||(a=new Promise((function(e){return setTimeout((function(){var t=(0,s.getCache)().productIdsQueue,i=Array.from(t);t.clear(),(0,s.updateCache)({productIdsQueue:t,productsPromise:void 0}),n.ajax.post("stickers.php",{act:"get_products",product_ids:i},{onDone:function(t){o(t,i),e([])},onFail:function(t){return console.error(t),o({},i),e([]),!0}})}),300)})),(0,s.updateCache)({productsPromise:a})),a);d.set(h,p),_.add(p)}}}catch(e){t={error:e}}finally{try{m&&!m.done&&(i=f.return)&&i.call(f)}finally{if(t)throw t.error}}return(0,s.updateCache)({productIdsQueue:u,productPromises:d}),Promise.all(_).then((function(){return c(e)}))},d=function(e,t){void 0===t&&(t=!0);var i=t?e.filter((function(e){return void 0===a(e)})):e;return i.length?l(i).then((function(){return c(e)})):Promise.resolve(c(e))},u=function(e,t){if(void 0===t&&(t=!0),t){var i=a(e);if(void 0!==i)return Promise.resolve(i)}return l([e]).then((function(){return a(e)}))},_=function(e){return new Promise((function(t){n.ajax.post("stickers.php",{act:"activate_product",product_id:e.id,hash:e.csrf_hash},{onDone:function(e){o(e),t()},onFail:function(e){return console.error(e),t(),!0}})}))},f=function(e,t,i,r){return void 0===r&&(r=!0),new Promise((function(s){n.ajax.post("stickers.php",{act:"update_user_product_state",product_ids:[e],key:t,value:i},{onDone:function(e){r&&o(e),s()},onFail:function(e){return console.error(e),s(),!0}})}))}},870264:(e,t,i)=>{"use strict";i.d(t,{giftStickersCart:()=>u,giftStickerProducts:()=>_});var r=i(570655),n=i(667294),s=i(973935),o=i(654612),a=i(399321),c=i(348230),l=i(665820),d=i(490808);function u(e,t){var i;if((0,l.getCache)().productsGiftLock)return null;(0,l.updateCache)({productsGiftLock:!0});var a=(0,r.__assign)({},t);function u(){return null==i?void 0:i.bodyNode.querySelector(".StickersProductsGift")}function _(){null==i||i.hide()}function f(){null==i||i.updateBoxCoords()}return(0,c.showLoader)(),e.isGift=!0,Promise.all([e.load(!0),window.stManager.add(["stickers.css","wide_dd.js","wide_dd.css"])]).then((function(e){var t=(0,r.__read)(e,2),m=t[0];t[1];(0,c.hideLoader)(),i=new o.MessageBox({hideButtons:!0,bodyStyle:"padding: 0; background: none;",width:450,onShow:function(){!function(e){var t=u();t&&s.render(n.createElement(d.default,{cart:e,options:a,closeBox:_,updateBox:f}),t)}(m),requestAnimationFrame((function(){f()}))},onHideAttempt:function(){var e;return(e=u())&&s.unmountComponentAtNode(e),!0},onHide:function(){(0,l.updateCache)({productsGiftLock:!1})}}),i.content('<div class="StickersProductsGift"></div>'),i.show()}),(function(){})),{hide:_}}function _(e,t,i){return void 0===t&&(t=[]),u(a.Cart.create(e,t),i)}},348230:(e,t,i)=>{"use strict";i.d(t,{getBoxLayerWrap:()=>d,showLoader:()=>u,hideLoader:()=>_,getPurchaseResult:()=>f});var r=i(786067),n=i(41650),s=i(315544),o=i(486125),a=i(749091),c=n.default.getLang;function l(){return document.querySelector("#box_loader")}function d(){return document.querySelector("#box_layer_wrap")}function u(){var e=l();(0,o.boxRefreshCoords)(e),(0,s.show)(e),(0,s.show)(d())}function _(){(0,s.hide)(l())}function f(e){var t=new a.ProductsByType(e.items.filter((function(e){return!e.error})).map((function(e){return e.product}))),i=t.getPack(),n=t.getStyles();if(i)return n.length?(0,r.langStr)(c("purchases_stickers_purchase_result_pack_and_styles",n.length),"pack_title",i.title,"n",n.length):(0,r.langStr)(c("purchases_stickers_purchase_result_pack"),"title",i.title);if(n.length)switch(n.length){case 1:return(0,r.langStr)(c("purchases_stickers_purchase_result_1_style"),"title",n[0].title);case 2:return(0,r.langStr)(c("purchases_stickers_purchase_result_2_styles"),"title1",n[0].title,"title2",n[1].title);case 3:return(0,r.langStr)(c("purchases_stickers_purchase_result_3_styles"),"title1",n[0].title,"title2",n[1].title,"title3",n[2].title);case 4:return(0,r.langStr)(c("purchases_stickers_purchase_result_3_styles_and_1_more"),"title1",n[0].title,"title2",n[1].title,"title3",n[2].title);default:var s=n.length-3;return(0,r.langStr)(c("purchases_stickers_purchase_result_3_styles_and_n_more",s),"title1",n[0].title,"title2",n[1].title,"title3",n[2].title,"n",s)}return null}}}]);try{stManager.done("dist/a1258c00747aa03727abf8c40b9e7df9.087e33755a3e825ec787.js")}catch(e){}